sso: Fix conflict between urls of sso and captcha

django-simple-captcha's /refresh url's regex was matching anything that ends
with the word "refresh". This was clashing with sso/refresh. Changed the regex
for captcha's url to captcha/refresh.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2017-11-08 19:26:25 +05:30 committed by James Valleroy
parent 111f8f9145
commit 5aabac036c
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 14 additions and 15 deletions

View File

@ -3,7 +3,7 @@
TKTAuthLoginURL /plinth/accounts/sso/login/
TKTAuthBackArgName next
TKTAuthDigest SHA512
TKTAuthRefreshURL /plinth/accounts/sso/refresh-pubtkt/
TKTAuthRefreshURL /plinth/accounts/sso/refresh/
TKTAuthUnauthURL /plinth
AuthType mod_auth_pubtkt
AuthName "FreedomBox Single Sign On"

View File

@ -26,9 +26,7 @@ from plinth.utils import non_admin_view
urlpatterns = [
url(r'^accounts/sso/login/$',
public(SSOLoginView.as_view()),
name='sso-login'),
url(r'^accounts/sso/refresh-pubtkt/$',
non_admin_view(refresh),
public(SSOLoginView.as_view()), name='sso-login'),
url(r'^accounts/sso/refresh/$', non_admin_view(refresh),
name='sso-refresh'),
]

View File

@ -33,16 +33,17 @@ urlpatterns = [
url(r'^sys/$', views.system_index, name='system'),
# captcha urls are public
url(r'image/(?P<key>\w+)/$',
public(cviews.captcha_image), name='captcha-image', kwargs={
'scale': 1
}),
url(r'image/(?P<key>\w+)@2/$',
public(cviews.captcha_image), name='captcha-image-2x', kwargs={
'scale': 2
}),
url(r'audio/(?P<key>\w+)/$',
url(r'^captcha/image/(?P<key>\w+)/$',
public(cviews.captcha_image), name='captcha-image',
kwargs={'scale': 1}),
url(r'^captcha/image/(?P<key>\w+)@2/$',
public(cviews.captcha_image), name='captcha-image-2x',
kwargs={'scale': 2}),
url(r'^captcha/audio/(?P<key>\w+)/$',
public(cviews.captcha_audio), name='captcha-audio'),
url(r'refresh/$', public(cviews.captcha_refresh), name='captcha-refresh'),
url(r'^captcha/refresh/$',
public(cviews.captcha_refresh), name='captcha-refresh'),
# locked url from django-axes
url(r'locked/$', public(CaptchaLoginView.as_view()), name='locked_out'),
]