Skip to content

Commit fc82a0d

Browse files
committed
fix bug in captcha
1 parent a8f3c84 commit fc82a0d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

captcha/decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def _wrapped_view(request, *args, **kwargs):
1717
"detail": "Captcha is required"
1818
}, status=status.HTTP_400_BAD_REQUEST)
1919

20-
if check(captcha_key, captcha_answer):
20+
if not check(captcha_key, captcha_answer):
2121
return Response({
2222
"detail": "Captcha wrong"
2323
}, status=status.HTTP_406_NOT_ACCEPTABLE)

captcha/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ def clean_expire(self):
1616

1717
expired_data = self.objects.filter(added_time__gte=tools.settimelater(timezone.now()))
1818
for edata in expired_data:
19-
path = os.path.join(settings.BASE_DIR, \
20-
"uploads", "captcha", "{name}.png".format(name=edata.key))
19+
path = os.path.join(settings.BASE_DIR, "uploads", "captcha", "{name}.png".format(name=edata.key))
2120
os.remove(path)
2221

2322
edata.delete()

0 commit comments

Comments
 (0)