From 64ad6931e993b5867ea5eec38d4ecd554d101a74 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 18 Mar 2022 20:08:16 +0100 Subject: [PATCH] Move 'is_valid_user = user is not None' into else --- core/admin/mailu/internal/nginx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/admin/mailu/internal/nginx.py b/core/admin/mailu/internal/nginx.py index b7e246af..2ee6d9b3 100644 --- a/core/admin/mailu/internal/nginx.py +++ b/core/admin/mailu/internal/nginx.py @@ -94,11 +94,11 @@ def handle_authentication(headers): else: try: user = models.User.query.get(user_email) if '@' in user_email else None - is_valid_user = user is not None except sqlalchemy.exc.StatementError as exc: exc = str(exc).split('\n', 1)[0] app.logger.warn(f'Invalid user {user_email!r}: {exc}') else: + is_valid_user = user is not None ip = urllib.parse.unquote(headers["Client-Ip"]) if check_credentials(user, password, ip, protocol, headers["Auth-Port"]): server, port = get_server(headers["Auth-Protocol"], True)