fix getting jwt fields from request
This commit is contained in:
@@ -17,9 +17,11 @@ class CustomizedTokenObtainPairSerializer(TokenObtainPairSerializer): # noqa
|
||||
"""
|
||||
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()
|
||||
|
||||
data = super().validate(attrs)
|
||||
|
||||
Reference in New Issue
Block a user