captcha: Fix issue with captcha path when captcha entered is wrong

Signed-off-by: Joseph Nuthalpati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalpati 2017-08-22 15:38:40 +05:30 committed by James Valleroy
parent 62f26433e8
commit 6e26c92441
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 3 additions and 1 deletions

View File

@ -244,6 +244,7 @@ def configure_django():
CACHES={'default':
{'BACKEND': 'django.core.cache.backends.dummy.DummyCache'}},
CAPTCHA_FONT_PATH=['/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf'],
CAPTCHA_LENGTH=6,
DATABASES={'default':
{'ENGINE': 'django.db.backends.sqlite3',
'NAME': cfg.store_file}},

View File

@ -62,7 +62,8 @@ class SSOLoginView(LoginView):
if request.user.is_authenticated:
return set_ticket_cookie(request.user, response)
else: # Redirect user to captcha page
return HttpResponseRedirect('captcha')
redirect = '' if request.path.rstrip('/').endswith('captcha') else 'captcha'
return HttpResponseRedirect(redirect)
return response