From e8b338b5b20c2f5ed11556e92b887d3943a7cdf6 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 c8eb5c7e..e54c413e 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,