Commit 612163db61bdd40be1030d30a575e29233af19cf
1 parent
6936a9ac
Exists in
master
and in
39 other branches
Clear cookies from gitlab and redmine sessions at logout
Signed-off-by: Charles de Oliveira <18oliveira.charles@gmail.com> Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com>
Showing
4 changed files
with
14 additions
and
2 deletions
Show diff stats
src/accounts/urls.py
@@ -4,6 +4,7 @@ from django.conf.urls import patterns, include, url | @@ -4,6 +4,7 @@ from django.conf.urls import patterns, include, url | ||
4 | from .views import (UserProfileDetailView, UserProfileUpdateView, | 4 | from .views import (UserProfileDetailView, UserProfileUpdateView, |
5 | ManageUserSubscriptionsView, ChangeXMPPPasswordView) | 5 | ManageUserSubscriptionsView, ChangeXMPPPasswordView) |
6 | 6 | ||
7 | +from accounts import views | ||
7 | 8 | ||
8 | urlpatterns = patterns('', | 9 | urlpatterns = patterns('', |
9 | url(r'^register/$', 'accounts.views.signup', name='signup'), | 10 | url(r'^register/$', 'accounts.views.signup', name='signup'), |
@@ -11,7 +12,7 @@ urlpatterns = patterns('', | @@ -11,7 +12,7 @@ urlpatterns = patterns('', | ||
11 | url(r'^change-password/$', | 12 | url(r'^change-password/$', |
12 | ChangeXMPPPasswordView.as_view(), name='change_password'), | 13 | ChangeXMPPPasswordView.as_view(), name='change_password'), |
13 | 14 | ||
14 | - url(r'^logout/?$', 'django.contrib.auth.views.logout'), | 15 | + url(r'^logout/?$', 'accounts.views.logoutColab'), |
15 | 16 | ||
16 | url(r'^(?P<username>[\w@+.-]+)/?$', | 17 | url(r'^(?P<username>[\w@+.-]+)/?$', |
17 | UserProfileDetailView.as_view(), name='user_profile'), | 18 | UserProfileDetailView.as_view(), name='user_profile'), |
src/accounts/views.py
@@ -5,6 +5,7 @@ import datetime | @@ -5,6 +5,7 @@ import datetime | ||
5 | 5 | ||
6 | from collections import OrderedDict | 6 | from collections import OrderedDict |
7 | 7 | ||
8 | +from django.contrib.auth.views import logout | ||
8 | from django.contrib import messages | 9 | from django.contrib import messages |
9 | from django.db import transaction | 10 | from django.db import transaction |
10 | from django.db.models import Count | 11 | from django.db.models import Count |
@@ -16,6 +17,7 @@ from django.core.exceptions import PermissionDenied | @@ -16,6 +17,7 @@ from django.core.exceptions import PermissionDenied | ||
16 | from django.views.generic import DetailView, UpdateView | 17 | from django.views.generic import DetailView, UpdateView |
17 | from django.utils.decorators import method_decorator | 18 | from django.utils.decorators import method_decorator |
18 | 19 | ||
20 | +from django.http import HttpResponse | ||
19 | from conversejs import xmpp | 21 | from conversejs import xmpp |
20 | from conversejs.models import XMPPAccount | 22 | from conversejs.models import XMPPAccount |
21 | from haystack.query import SearchQuerySet | 23 | from haystack.query import SearchQuerySet |
@@ -111,6 +113,13 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): | @@ -111,6 +113,13 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): | ||
111 | return super(UserProfileDetailView, self).get_context_data(**context) | 113 | return super(UserProfileDetailView, self).get_context_data(**context) |
112 | 114 | ||
113 | 115 | ||
116 | +def logoutColab(request): | ||
117 | + response = logout(request, next_page='/') | ||
118 | + response.delete_cookie('_redmine_session') | ||
119 | + response.delete_cookie('_gitlab_session') | ||
120 | + return response | ||
121 | + | ||
122 | + | ||
114 | def signup(request): | 123 | def signup(request): |
115 | # If the request method is GET just return the form | 124 | # If the request method is GET just return the form |
116 | if request.method == 'GET': | 125 | if request.method == 'GET': |
src/colab/custom_settings.py
@@ -281,7 +281,7 @@ BROWSERID_AUDIENCES = [SITE_URL, SITE_URL.replace('https', 'http')] | @@ -281,7 +281,7 @@ BROWSERID_AUDIENCES = [SITE_URL, SITE_URL.replace('https', 'http')] | ||
281 | LOGIN_URL = '/' | 281 | LOGIN_URL = '/' |
282 | LOGIN_REDIRECT_URL = '/' | 282 | LOGIN_REDIRECT_URL = '/' |
283 | LOGIN_REDIRECT_URL_FAILURE = '/' | 283 | LOGIN_REDIRECT_URL_FAILURE = '/' |
284 | -LOGOUT_REDIRECT_URL = '/' | 284 | +LOGOUT_REDIRECT_URL = '/user/logout' |
285 | BROWSERID_CREATE_USER = False | 285 | BROWSERID_CREATE_USER = False |
286 | 286 | ||
287 | 287 |
src/colab/local_settings-dev.py
@@ -34,6 +34,8 @@ HAYSTACK_CONNECTIONS['default']['URL'] = 'http://localhost:8983/solr/' | @@ -34,6 +34,8 @@ HAYSTACK_CONNECTIONS['default']['URL'] = 'http://localhost:8983/solr/' | ||
34 | 34 | ||
35 | COLAB_TRAC_URL = 'http://localhost:5000/' | 35 | COLAB_TRAC_URL = 'http://localhost:5000/' |
36 | COLAB_CI_URL = 'http://localhost:8080/ci/' | 36 | COLAB_CI_URL = 'http://localhost:8080/ci/' |
37 | +COLAB_GITLAB_URL = 'http://localhost:8090/gitlab/' | ||
38 | +COLAB_REDMINE_URL = 'http://localhost:9080/redmine/' | ||
37 | 39 | ||
38 | CONVERSEJS_ENABLED = False | 40 | CONVERSEJS_ENABLED = False |
39 | 41 |