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