Add password suggestions to change and set password forms

This commit is contained in:
rubenwardy 2020-12-05 00:29:57 +00:00
parent afb87c525d
commit 7c07ac22ad
2 changed files with 13 additions and 2 deletions

@ -228,7 +228,8 @@ def change_password():
else:
flash("Old password is incorrect", "danger")
return render_template("users/change_set_password.html", form=form)
return render_template("users/change_set_password.html", form=form,
suggested_password=genphrase(entropy=52, wordset="bip39"))
@bp.route("/user/set-password/", methods=["GET", "POST"])
@ -246,7 +247,8 @@ def set_password():
if ret:
return ret
return render_template("users/change_set_password.html", form=form, optional=request.args.get("optional"))
return render_template("users/change_set_password.html", form=form, optional=request.args.get("optional"),
suggested_password=genphrase(entropy=52, wordset="bip39"))
@bp.route("/user/verify/")

@ -38,6 +38,15 @@
{{ render_field(form.password, tabindex=230) }}
{{ render_field(form.password2, tabindex=240) }}
<p>
Must be at least 8 characters long.
</p>
<p>
Password suggestion
(<a href="https://xkcd.com/936/">Why?</a>):
<code>{{ suggested_password }}</code>
</p>
{{ render_submit_field(form.submit, tabindex=280) }}
</form>