From c9f281e8f7bffda15cd245cef11eb7a7f759b2c4 Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Thu, 8 May 2025 11:09:18 +0800 Subject: [PATCH] fix: Handle exceptions in leak password check --- apps/users/models/user/_auth.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/users/models/user/_auth.py b/apps/users/models/user/_auth.py index ea4c7aa6f..0dd5f165b 100644 --- a/apps/users/models/user/_auth.py +++ b/apps/users/models/user/_auth.py @@ -302,5 +302,9 @@ class AuthMixin: @staticmethod def check_leak_password(password): - is_exist = LeakPasswords.objects.using('sqlite').filter(password=password).exists() - return is_exist + try: + is_exist = LeakPasswords.objects.using('sqlite').filter(password=password).exists() + return is_exist + except Exception: + logger.warning("check leak password failed") + return False