summaryrefslogtreecommitdiff
path: root/src/meetingtools
diff options
context:
space:
mode:
Diffstat (limited to 'src/meetingtools')
-rw-r--r--src/meetingtools/apps/auth/views.py19
-rw-r--r--src/meetingtools/urls.py3
2 files changed, 13 insertions, 9 deletions
diff --git a/src/meetingtools/apps/auth/views.py b/src/meetingtools/apps/auth/views.py
index a95a2bd..d74377a 100644
--- a/src/meetingtools/apps/auth/views.py
+++ b/src/meetingtools/apps/auth/views.py
@@ -9,9 +9,11 @@ import datetime
from django.views.decorators.cache import never_cache
import logging
from meetingtools.apps.userprofile.models import UserProfile
-from meetingtools.multiresponse import redirect_to
+from meetingtools.multiresponse import redirect_to, make_response_dict
from meetingtools.apps.room.views import _acc_for_user
from meetingtools.ac import ac_api_client
+from django.shortcuts import render_to_response
+from django.contrib import auth
def meta(request,attr):
v = request.META.get(attr)
@@ -37,6 +39,15 @@ def _is_member_or_employee(affiliations):
lpa = map(_localpart,affiliations)
return 'student' in lpa or 'staff' in lpa or ('member' in lpa and not 'student' in lpa)
+@never_cache
+def logout(request):
+ auth.logout(request)
+ return HttpResponseRedirect('/Shibboleth.sso/Logout')
+
+@never_cache
+def login(request):
+ return render_to_response('apps/auth/login.html',make_response_dict(request,{'next': request.REQUEST.get("next")}));
+
def accounts_login_federated(request):
if request.user.is_authenticated():
profile,created = UserProfile.objects.get_or_create(user=request.user)
@@ -122,9 +133,3 @@ def accounts_login_federated(request):
else:
pass
return redirect_to("/")
-
-@never_cache
-def logout(request):
- from django.contrib.auth import logout
- logout(request)
- return HttpResponseRedirect("/Shibboleth.sso/Logout") \ No newline at end of file
diff --git a/src/meetingtools/urls.py b/src/meetingtools/urls.py
index 3e6e652..74a2052 100644
--- a/src/meetingtools/urls.py
+++ b/src/meetingtools/urls.py
@@ -16,8 +16,7 @@ urlpatterns = patterns('',
(r'^admin-media/(?P<path>.*)$', 'django.views.static.serve',{'document_root': ADMIN_MEDIA_ROOT}),
(r'^site-media/(?P<path>.*)$', 'django.views.static.serve',{'document_root': MEDIA_ROOT}),
# Login/Logout
- (r'^accounts/login/$',login,{'template_name': "login.html"}),
- (r'^accounts/logout$',logout),
+ (r'^accounts/login/?$','meetingtools.apps.auth.views.login'),
(r'^accounts/login-federated/$','meetingtools.apps.auth.views.accounts_login_federated'),
(r'^accounts/logout/$','meetingtools.apps.auth.views.logout'),
(r'^rooms?$','meetingtools.apps.room.views.list'),