|
|
|
@ -31,6 +31,7 @@ def nginx_authentication():
|
|
|
|
|
for key, value in headers.items():
|
|
|
|
|
response.headers[key] = str(value)
|
|
|
|
|
is_valid_user = False
|
|
|
|
|
is_from_webmail = headers['Auth-Port'] in ['10143', '10025']
|
|
|
|
|
if response.headers.get("Auth-User-Exists"):
|
|
|
|
|
username = response.headers["Auth-User"]
|
|
|
|
|
if utils.limiter.should_rate_limit_user(username, client_ip):
|
|
|
|
@ -47,7 +48,7 @@ def nginx_authentication():
|
|
|
|
|
utils.limiter.exempt_ip_from_ratelimits(client_ip)
|
|
|
|
|
elif is_valid_user:
|
|
|
|
|
utils.limiter.rate_limit_user(username, client_ip)
|
|
|
|
|
else:
|
|
|
|
|
elif not is_from_webmail:
|
|
|
|
|
utils.limiter.rate_limit_ip(client_ip)
|
|
|
|
|
return response
|
|
|
|
|
|
|
|
|
|