From 7b9c4e01f7bea51e9f0d02da1a501b8760aeb57a Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 5 Mar 2022 18:36:27 +0100 Subject: [PATCH] improve --- core/admin/mailu/internal/nginx.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/admin/mailu/internal/nginx.py b/core/admin/mailu/internal/nginx.py index 02998fed..03142e62 100644 --- a/core/admin/mailu/internal/nginx.py +++ b/core/admin/mailu/internal/nginx.py @@ -93,10 +93,9 @@ def handle_authentication(headers): app.logger.warn(f'Received undecodable user/password from nginx: {raw_user_email!r}/{raw_password!r}') else: try: - user = models.User.query.get(user_email) - is_valid_user = True - except ValueError: - pass + if '@' in user_email: + user = models.User.query.get(user_email) + is_valid_user = True except sqlalchemy.exc.StatementError as exc: exc = str(exc).split('\n', 1)[0] app.logger.warn(f'Invalid user {user_email!r}: {exc}')