refactor: adjust max_attempts default and captcha requirement in authentication logic

This commit is contained in:
wxg0103 2025-09-17 10:26:43 +08:00
parent 0969f70104
commit cf91734db5

View File

@ -76,12 +76,12 @@ class LoginSerializer(serializers.Serializer):
except Exception:
auth_setting = {}
max_attempts = auth_setting.get("max_attempts", 0)
max_attempts = auth_setting.get("max_attempts", 1)
password = instance.get("password")
captcha = instance.get("captcha", "")
# 判断是否需要验证码
need_captcha = True
need_captcha = False
if max_attempts == -1:
need_captcha = False
elif max_attempts > 0: