diff --git a/core/admin/mailu/internal/views/auth.py b/core/admin/mailu/internal/views/auth.py index 0ed967ba..1ea2828a 100644 --- a/core/admin/mailu/internal/views/auth.py +++ b/core/admin/mailu/internal/views/auth.py @@ -36,9 +36,9 @@ def nginx_authentication(): response.headers['Auth-Wait'] = '3' return response is_valid_user = True - if ("Auth-Status" not in headers) or (headers["Auth-Status"] != "OK"): + if headers.get('Auth-Status') != 'OK': utils.limiter.rate_limit_user(username, client_ip) if is_valid_user else rate_limit_ip(client_ip) - elif ("Auth-Status" in headers) and (headers["Auth-Status"] == "OK"): + elif headers["Auth-Status"] == "OK": utils.limiter.exempt_ip_from_ratelimits(client_ip) return response