ensure current_limit exist before displaying any message based on it

This commit is contained in:
Glandos 2022-08-28 15:32:47 +02:00 committed by Alexis Metaireau
parent 63fba6be4c
commit d834394a44

View file

@ -192,8 +192,10 @@ def admin():
session["is_admin"] = True
session.update()
return redirect(goto)
if limiter.current_limit is not None:
msg = _(
"This admin password is not the right one. Only %(num)d attempts left.",
# If the limiter is disabled, there is no current limit
num=limiter.current_limit.remaining,
)
form["admin_password"].errors = [msg]