fix getting jwt fields from request

This commit is contained in:
2025-05-04 16:47:43 +03:30
parent 185e1bc339
commit 6648dc8de7

View File

@@ -17,9 +17,11 @@ class CustomizedTokenObtainPairSerializer(TokenObtainPairSerializer): # noqa
""" """
override validate method to add more conditions override validate method to add more conditions
""" """
captcha_code, captcha_key = attrs['captcha_code'], attrs['captcha_key']
if captcha_code != cache.get(captcha_key) or captcha_code not in attrs.keys(): captcha_code = self.context['request'].data['captcha_code']
captcha_key = self.context['request'].data['captcha_key']
if captcha_code != cache.get(captcha_key) or captcha_code not in self.context['request'].data.keys():
raise captcha_exception.CaptchaFailed() raise captcha_exception.CaptchaFailed()
data = super().validate(attrs) data = super().validate(attrs)