From 910eb2ccd496f7cebe4213d73890d29858fa97ec Mon Sep 17 00:00:00 2001 From: zhengxie Date: Tue, 1 Apr 2014 15:02:16 +0800 Subject: [PATCH] Add sigle sign on feature --- thirdpart/registration/auth_urls.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/thirdpart/registration/auth_urls.py b/thirdpart/registration/auth_urls.py index 3cdcd2fe05..824ceb1e60 100644 --- a/thirdpart/registration/auth_urls.py +++ b/thirdpart/registration/auth_urls.py @@ -29,15 +29,6 @@ from django.conf.urls.defaults import * from seahub.auth import views as auth_views urlpatterns = patterns('', - url(r'^login/$', - auth_views.login, - {'template_name': 'registration/login.html', - 'redirect_if_logged_in': 'myhome'}, - name='auth_login'), - url(r'^logout/$', - auth_views.logout, - {'template_name': 'registration/logout.html'}, - name='auth_logout'), url(r'^password/change/$', auth_views.password_change, name='auth_password_change'), @@ -63,3 +54,21 @@ if getattr(settings, 'ENABLE_LOGIN_SIMPLE_CHECK', False): (r'^login/simple_check/$', auth_views.login_simple_check), ) + +if getattr(settings, 'ENABLE_SSO', False): + urlpatterns += patterns('', + url(r'^login/$', 'django_cas.views.login'), + url(r'^logout/$', 'django_cas.views.logout'), + ) +else: + urlpatterns += patterns('', + url(r'^login/$', + auth_views.login, + {'template_name': 'registration/login.html', + 'redirect_if_logged_in': 'myhome'}, + name='auth_login'), + url(r'^logout/$', + auth_views.logout, + {'template_name': 'registration/logout.html'}, + name='auth_logout'), + )