simplify the Auth-Status check

master
Florent Daigniere 3 years ago
parent 2dd9ea1506
commit 3bda8368e4

@ -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

Loading…
Cancel
Save