refactor: adjust max_attempts default and captcha requirement in authentication logic
parent
0969f70104
commit
cf91734db5
|
|
@ -76,12 +76,12 @@ class LoginSerializer(serializers.Serializer):
|
||||||
except Exception:
|
except Exception:
|
||||||
auth_setting = {}
|
auth_setting = {}
|
||||||
|
|
||||||
max_attempts = auth_setting.get("max_attempts", 0)
|
max_attempts = auth_setting.get("max_attempts", 1)
|
||||||
password = instance.get("password")
|
password = instance.get("password")
|
||||||
captcha = instance.get("captcha", "")
|
captcha = instance.get("captcha", "")
|
||||||
|
|
||||||
# 判断是否需要验证码
|
# 判断是否需要验证码
|
||||||
need_captcha = True
|
need_captcha = False
|
||||||
if max_attempts == -1:
|
if max_attempts == -1:
|
||||||
need_captcha = False
|
need_captcha = False
|
||||||
elif max_attempts > 0:
|
elif max_attempts > 0:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue