mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Update
This commit is contained in:
		@@ -23,10 +23,14 @@ class RegistrationForm(FlaskForm):
 | 
			
		||||
    )
 | 
			
		||||
    password = PasswordField(
 | 
			
		||||
        'Password',
 | 
			
		||||
        validators=[DataRequired(),
 | 
			
		||||
                    EqualTo('password2', message='Passwords must match.')]
 | 
			
		||||
        validators=[DataRequired(), EqualTo('password_confirmation',
 | 
			
		||||
                                            message='Passwords must match.')]
 | 
			
		||||
    )
 | 
			
		||||
    password_confirmation = PasswordField(
 | 
			
		||||
        'Password confirmation',
 | 
			
		||||
        validators=[DataRequired(), EqualTo('password',
 | 
			
		||||
                                            message='Passwords must match.')]
 | 
			
		||||
    )
 | 
			
		||||
    password2 = PasswordField('Confirm password', validators=[DataRequired()])
 | 
			
		||||
    submit = SubmitField('Register')
 | 
			
		||||
 | 
			
		||||
    def validate_email(self, field):
 | 
			
		||||
@@ -40,12 +44,12 @@ class RegistrationForm(FlaskForm):
 | 
			
		||||
 | 
			
		||||
class ResetPasswordForm(FlaskForm):
 | 
			
		||||
    password = PasswordField(
 | 
			
		||||
        'New Password',
 | 
			
		||||
        validators=[DataRequired(),
 | 
			
		||||
                    EqualTo('password2', message='Passwords must match')]
 | 
			
		||||
        'New password',
 | 
			
		||||
        validators=[DataRequired(), EqualTo('password_confirmation',
 | 
			
		||||
                                            message='Passwords must match.')]
 | 
			
		||||
    )
 | 
			
		||||
    password2 = PasswordField(
 | 
			
		||||
        'Confirm password',
 | 
			
		||||
    password_confirmation = PasswordField(
 | 
			
		||||
        'Password confirmation',
 | 
			
		||||
        validators=[DataRequired(),
 | 
			
		||||
                    EqualTo('password', message='Passwords must match.')]
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,8 @@ def before_request():
 | 
			
		||||
 | 
			
		||||
@auth.route('/login', methods=['GET', 'POST'])
 | 
			
		||||
def login():
 | 
			
		||||
    if current_user.is_authenticated:
 | 
			
		||||
        return redirect(url_for('main.dashboard'))
 | 
			
		||||
    login_form = LoginForm(prefix='login-form')
 | 
			
		||||
    if login_form.validate_on_submit():
 | 
			
		||||
        user = User.query.filter_by(email=login_form.email.data).first()
 | 
			
		||||
@@ -111,7 +113,9 @@ def resend_confirmation():
 | 
			
		||||
def reset_password_request():
 | 
			
		||||
    if current_user.is_authenticated:
 | 
			
		||||
        return redirect(url_for('main.dashboard'))
 | 
			
		||||
    reset_password_request_form = ResetPasswordRequestForm()
 | 
			
		||||
    reset_password_request_form = ResetPasswordRequestForm(
 | 
			
		||||
        prefix='reset-password-request-form'
 | 
			
		||||
    )
 | 
			
		||||
    if reset_password_request_form.validate_on_submit():
 | 
			
		||||
        submitted_email = reset_password_request_form.email.data
 | 
			
		||||
        user = User.query.filter_by(email=submitted_email.lower()).first()
 | 
			
		||||
@@ -133,7 +137,7 @@ def reset_password_request():
 | 
			
		||||
def reset_password(token):
 | 
			
		||||
    if current_user.is_authenticated:
 | 
			
		||||
        return redirect(url_for('main.dashboard'))
 | 
			
		||||
    reset_password_form = ResetPasswordForm()
 | 
			
		||||
    reset_password_form = ResetPasswordForm(prefix='reset-password-form')
 | 
			
		||||
    if reset_password_form.validate_on_submit():
 | 
			
		||||
        if User.reset_password(token, reset_password_form.password.data):
 | 
			
		||||
            db.session.commit()
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@
 | 
			
		||||
            <div class="switch">
 | 
			
		||||
              <label>
 | 
			
		||||
                Remember me
 | 
			
		||||
                {{ login_form.remember_me() }}
 | 
			
		||||
                {{ login_form.remember_me(class='validate') }}
 | 
			
		||||
                <span class="lever"></span>
 | 
			
		||||
              </label>
 | 
			
		||||
            </div>
 | 
			
		||||
@@ -44,7 +44,7 @@
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="card-action right-align">
 | 
			
		||||
        {{ login_form.submit(class='btn') }}
 | 
			
		||||
        <button class="btn waves-effect waves-light" id="login-form-submit" name="login-form-submit" type="submit">Log in<i class="material-icons right">send</i></button>
 | 
			
		||||
      </div>
 | 
			
		||||
    </form>
 | 
			
		||||
  </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -29,9 +29,9 @@
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="input-field">
 | 
			
		||||
          <i class="material-icons prefix">vpn_key</i>
 | 
			
		||||
          {{ registration_form.password2(class='validate') }}
 | 
			
		||||
          {{ registration_form.password2.label }}
 | 
			
		||||
          {% for error in registration_form.password2.errors %}
 | 
			
		||||
          {{ registration_form.password_confirmation(class='validate') }}
 | 
			
		||||
          {{ registration_form.password_confirmation.label }}
 | 
			
		||||
          {% for error in registration_form.password_confirmation.errors %}
 | 
			
		||||
            <span class="helper-text red-text">{{ error }}</span>
 | 
			
		||||
          {% endfor %}
 | 
			
		||||
        </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -12,22 +12,22 @@
 | 
			
		||||
      <div class="card-content">
 | 
			
		||||
        {{ reset_password_form.hidden_tag() }}
 | 
			
		||||
        <div class="input-field">
 | 
			
		||||
          {{ reset_password_form.password(type='password') }}
 | 
			
		||||
          {{ reset_password_form.password(class='validate') }}
 | 
			
		||||
          {{ reset_password_form.password.label }}
 | 
			
		||||
          {% for error in reset_password_form.password.errors %}
 | 
			
		||||
            <span class="helper-text red-text">{{ error }}</span>
 | 
			
		||||
          {% endfor %}
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="input-field">
 | 
			
		||||
          {{ reset_password_form.password2(type='password') }}
 | 
			
		||||
          {{ reset_password_form.password2.label }}
 | 
			
		||||
          {% for error in reset_password_form.password2.errors %}
 | 
			
		||||
          {{ reset_password_form.password_confirmation(class='validate') }}
 | 
			
		||||
          {{ reset_password_form.password_confirmation.label }}
 | 
			
		||||
          {% for error in reset_password_form.password_confirmation.errors %}
 | 
			
		||||
            <span class="helper-text red-text">{{ error }}</span>
 | 
			
		||||
          {% endfor %}
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="card-action right-align">
 | 
			
		||||
        {{ reset_password_form.submit(class='btn') }}
 | 
			
		||||
        <button class="btn waves-effect waves-light" id="reset-password-form-submit" name="reset-password-form-submit" type="submit">Reset Password<i class="material-icons right">send</i></button>
 | 
			
		||||
      </div>
 | 
			
		||||
    </form>
 | 
			
		||||
  </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="card-action right-align">
 | 
			
		||||
        {{ reset_password_request_form.submit(class='btn') }}
 | 
			
		||||
        <button class="btn waves-effect waves-light" id="reset-password-request-form-submit" name="reset-password-request-form-submit" type="submit">Reset Password<i class="material-icons right">send</i></button>
 | 
			
		||||
      </div>
 | 
			
		||||
    </form>
 | 
			
		||||
  </div>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user