mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Small changes everywhere
This commit is contained in:
		@@ -35,10 +35,8 @@ class RegistrationForm(FlaskForm):
 | 
			
		||||
    email = StringField('Email', validators=[DataRequired(), Email()])
 | 
			
		||||
    username = StringField(
 | 
			
		||||
        'Username',
 | 
			
		||||
        validators=[DataRequired(),
 | 
			
		||||
                    Length(1, 64),
 | 
			
		||||
                    Regexp('^[A-Za-z][A-Za-z0-9_.]*$',
 | 
			
		||||
                           0,
 | 
			
		||||
        validators=[DataRequired(), Length(1, 64),
 | 
			
		||||
                    Regexp('^[A-Za-z][A-Za-z0-9_.]*$', 0,
 | 
			
		||||
                           'Usernames must have only letters, numbers, dots '
 | 
			
		||||
                           'or underscores')]
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
@@ -22,15 +22,14 @@ def logout():
 | 
			
		||||
def register():
 | 
			
		||||
    if not current_user.is_anonymous:
 | 
			
		||||
        return redirect(url_for('main.dashboard'))
 | 
			
		||||
    registration_form = RegistrationForm()
 | 
			
		||||
    registration_form = RegistrationForm(prefix='registration-form')
 | 
			
		||||
    if registration_form.validate_on_submit():
 | 
			
		||||
        user = User(email=registration_form.email.data.lower(),
 | 
			
		||||
                    password=registration_form.password.data,
 | 
			
		||||
                    username=registration_form.username.data)
 | 
			
		||||
        db.session.add(user)
 | 
			
		||||
        db.session.commit()
 | 
			
		||||
        dir = os.path.join(current_app.config['NOPAQUE_STORAGE'],
 | 
			
		||||
                           str(user.id))
 | 
			
		||||
        dir = os.path.join(current_app.config['NOPAQUE_STORAGE'], str(user.id))
 | 
			
		||||
        try:
 | 
			
		||||
            os.makedirs(dir)
 | 
			
		||||
        except OSError:
 | 
			
		||||
@@ -41,8 +40,9 @@ def register():
 | 
			
		||||
            send_email(user.email, 'Confirm Your Account',
 | 
			
		||||
                       'auth/email/confirm', token=token, user=user)
 | 
			
		||||
            flash('A confirmation email has been sent to you by email.')
 | 
			
		||||
            return redirect(url_for('auth.login'))
 | 
			
		||||
    return render_template('auth/register.html.j2', form=registration_form,
 | 
			
		||||
            return redirect(url_for('main.index'))
 | 
			
		||||
    return render_template('auth/register.html.j2',
 | 
			
		||||
                           registration_form=registration_form,
 | 
			
		||||
                           title='Register')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -108,7 +108,7 @@ def password_reset_request():
 | 
			
		||||
                       user=user)
 | 
			
		||||
        flash('An email with instructions to reset your password has been '
 | 
			
		||||
              'sent to you.')
 | 
			
		||||
        return redirect(url_for('auth.login'))
 | 
			
		||||
        return redirect(url_for('main.index'))
 | 
			
		||||
    return render_template('auth/reset_password_request.html.j2',
 | 
			
		||||
                           form=form,
 | 
			
		||||
                           title='Password Reset')
 | 
			
		||||
@@ -123,7 +123,7 @@ def password_reset(token):
 | 
			
		||||
        if User.reset_password(token, form.password.data):
 | 
			
		||||
            db.session.commit()
 | 
			
		||||
            flash('Your password has been updated.')
 | 
			
		||||
            return redirect(url_for('auth.login'))
 | 
			
		||||
            return redirect(url_for('main.index'))
 | 
			
		||||
        else:
 | 
			
		||||
            return redirect(url_for('main.index'))
 | 
			
		||||
    return render_template('auth/reset_password.html.j2',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user