From d834394a44c6b5d2a7c98b148457bc73736abb91 Mon Sep 17 00:00:00 2001 From: Glandos Date: Sun, 28 Aug 2022 15:32:47 +0200 Subject: [PATCH] ensure current_limit exist before displaying any message based on it --- ihatemoney/web.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ihatemoney/web.py b/ihatemoney/web.py index af50aed2..b94a66d7 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -192,11 +192,13 @@ def admin(): session["is_admin"] = True session.update() return redirect(goto) - msg = _( - "This admin password is not the right one. Only %(num)d attempts left.", - num=limiter.current_limit.remaining, - ) - form["admin_password"].errors = [msg] + 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] return render_template( "admin.html", form=form,