1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-14 10:53:30 +02:00

as per review

(cherry picked from commit 78c5d34227)
This commit is contained in:
Florent Daigniere 2024-08-09 15:29:51 +02:00 committed by Mergify
parent 14196e5054
commit f2c0a147fa
2 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ def handle_authentication(headers):
password = urllib.parse.unquote(headers["Auth-Pass"])
ip = urllib.parse.unquote(headers["Client-Ip"])
except:
app.logger.warn(f'Received undecodable user/password from nginx: {headers["Auth-User"]!r}/{headers["Auth-Pass"]!r}')
app.logger.warn(f'Received undecodable user/password from nginx: {headers.get("Auth-User", "")!r}')
else:
try:
user = models.User.query.get(user_email) if '@' in user_email else None

View File

@ -49,7 +49,7 @@ def nginx_authentication():
if not is_port_25:
utils.limiter.exempt_ip_from_ratelimits(client_ip)
elif is_valid_user:
password = urllib.parse.unquote(headers.get('Auth-Pass', None))
password = urllib.parse.unquote(headers.get('Auth-Pass', ''))
utils.limiter.rate_limit_user(username, client_ip, password=password)
elif not is_from_webmail:
utils.limiter.rate_limit_ip(client_ip, username)