mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-25 17:22:55 +00:00
fix: Verification code is not case sensitive (#3121)
This commit is contained in:
parent
71fdce08d7
commit
289ebf42a6
|
|
@ -64,7 +64,7 @@ class CaptchaSerializer(ApiMixin, serializers.Serializer):
|
|||
image = ImageCaptcha()
|
||||
data = image.generate(chars)
|
||||
captcha = base64.b64encode(data.getbuffer())
|
||||
captcha_cache.set(f"LOGIN:{chars}", chars, timeout=5 * 60)
|
||||
captcha_cache.set(f"LOGIN:{chars.lower()}", chars, timeout=5 * 60)
|
||||
return 'data:image/png;base64,' + captcha.decode()
|
||||
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ class LoginSerializer(ApiMixin, serializers.Serializer):
|
|||
"""
|
||||
super().is_valid(raise_exception=True)
|
||||
captcha = self.data.get('captcha')
|
||||
captcha_value = captcha_cache.get(f"LOGIN:{captcha}")
|
||||
captcha_value = captcha_cache.get(f"LOGIN:{captcha.lower()}")
|
||||
if captcha_value is None:
|
||||
raise AppApiException(1005, _("Captcha code error or expiration"))
|
||||
username = self.data.get("username")
|
||||
|
|
|
|||
Loading…
Reference in New Issue