mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-30 18:22:38 +02:00
Adapt code for https://github.com/wtforms/wtforms/pull/568
This commit is contained in:
parent
6c43ffaac4
commit
69a1ad6685
1 changed files with 4 additions and 4 deletions
|
@ -161,7 +161,7 @@ def admin():
|
||||||
client_ip = request.remote_addr
|
client_ip = request.remote_addr
|
||||||
if not login_throttler.is_login_allowed(client_ip):
|
if not login_throttler.is_login_allowed(client_ip):
|
||||||
msg = _("Too many failed login attempts, please retry later.")
|
msg = _("Too many failed login attempts, please retry later.")
|
||||||
form.errors["admin_password"] = [msg]
|
form["admin_password"].errors = [msg]
|
||||||
return render_template(
|
return render_template(
|
||||||
"admin.html",
|
"admin.html",
|
||||||
form=form,
|
form=form,
|
||||||
|
@ -183,7 +183,7 @@ def admin():
|
||||||
"This admin password is not the right one. Only %(num)d attempts left.",
|
"This admin password is not the right one. Only %(num)d attempts left.",
|
||||||
num=login_throttler.get_remaining_attempts(client_ip),
|
num=login_throttler.get_remaining_attempts(client_ip),
|
||||||
)
|
)
|
||||||
form.errors["admin_password"] = [msg]
|
form["admin_password"].errors = [msg]
|
||||||
return render_template(
|
return render_template(
|
||||||
"admin.html",
|
"admin.html",
|
||||||
form=form,
|
form=form,
|
||||||
|
@ -210,7 +210,7 @@ def authenticate(project_id=None):
|
||||||
# User doesn't provide project identifier or a valid token
|
# User doesn't provide project identifier or a valid token
|
||||||
# return to authenticate form
|
# return to authenticate form
|
||||||
msg = _("You either provided a bad token or no project identifier.")
|
msg = _("You either provided a bad token or no project identifier.")
|
||||||
form.errors["id"] = [msg]
|
form["id"].errors = [msg]
|
||||||
return render_template("authenticate.html", form=form)
|
return render_template("authenticate.html", form=form)
|
||||||
|
|
||||||
project = Project.query.get(project_id)
|
project = Project.query.get(project_id)
|
||||||
|
@ -246,7 +246,7 @@ def authenticate(project_id=None):
|
||||||
return redirect(url_for(".list_bills"))
|
return redirect(url_for(".list_bills"))
|
||||||
if is_post_auth and not check_password_hash(project.password, form.password.data):
|
if is_post_auth and not check_password_hash(project.password, form.password.data):
|
||||||
msg = _("This private code is not the right one")
|
msg = _("This private code is not the right one")
|
||||||
form.errors["password"] = [msg]
|
form["password"].errors = [msg]
|
||||||
|
|
||||||
return render_template("authenticate.html", form=form)
|
return render_template("authenticate.html", form=form)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue