diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-06-04 18:34:04 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-06-04 18:34:04 +0100 |
commit | 4420f489acfe9046def5bf6e36f2d3a557100d5f (patch) | |
tree | 0b9c63fe413f05f4e3f6f6a73fe333431809dffe | |
parent | aad4fd2a705009f6c66834aa2834298f1557d989 (diff) | |
download | cheatdb-4420f489acfe9046def5bf6e36f2d3a557100d5f.tar.xz |
Require email in set password
-rw-r--r-- | app/views/users.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/views/users.py b/app/views/users.py index 6dc1405..43dea8e 100644 --- a/app/views/users.py +++ b/app/views/users.py @@ -109,7 +109,7 @@ def user_profile_page(username): user=user, form=form, packages=packages, topics_to_add=topics_to_add) class SetPasswordForm(FlaskForm): - email = StringField("Email (Optional)", [Optional(), Email()]) + email = StringField("Email", [Optional(), Email()]) password = PasswordField("New password", [InputRequired(), Length(2, 20)]) password2 = PasswordField("Verify password", [InputRequired(), Length(2, 20)]) submit = SubmitField("Save") @@ -121,6 +121,9 @@ def set_password_page(): return redirect(url_for("user.change_password")) form = SetPasswordForm(request.form) + if current_user.email == None: + form.email.validators = [InputRequired(), Email()] + if request.method == "POST" and form.validate(): one = form.password.data two = form.password2.data |