fix captcha wrong in jwt confitions
This commit is contained in:
@@ -151,10 +151,8 @@ CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
"LOCATION": "redis://:ydnW4hwzuDRYcTX3FWCHgQ1f@apo.liara.cloud:33740/0",
|
||||
# "LOCATION": "redis://127.0.0.1:6379/1",
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||
# "PASSWORD": "foobar"
|
||||
},
|
||||
"KEY_PREFIX": "You have successfully set up a key-value pair!"
|
||||
},
|
||||
@@ -173,7 +171,7 @@ REST_CAPTCHA = {
|
||||
'CAPTCHA_LETTER_ROTATION': (-35, 35),
|
||||
'CAPTCHA_FOREGROUND_COLOR': '#000000',
|
||||
'CAPTCHA_BACKGROUND_COLOR': '#ffffff',
|
||||
# 'CAPTCHA_FONT_PATH': 'apps.authentication.api.v1.serializers.captcha.FONT_PATH',
|
||||
# 'CAPTCHA_FONT_PATH':
|
||||
'CAPTCHA_CACHE_KEY': 'rest_captcha_{key}.{version}',
|
||||
'FILTER_FUNCTION': 'rest_captcha.captcha.filter_default',
|
||||
'NOISE_FUNCTION': 'apps.captcha_app.api.v1.serializers.noise_default'
|
||||
|
||||
@@ -20,8 +20,8 @@ class CustomizedTokenObtainPairSerializer(TokenObtainPairSerializer): # noqa
|
||||
|
||||
captcha_code = self.context['request'].data['captcha_code']
|
||||
captcha_key = self.context['request'].data['captcha_key']
|
||||
return {"cache_key": cache.get(captcha_key)}
|
||||
if captcha_code != cache.get(captcha_key) or captcha_code not in self.context['request'].data.keys():
|
||||
|
||||
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