0001-merge-local-and-idp-logout-9865.patch
mandayejs/applications.py | ||
---|---|---|
250 | 250 | |
251 | 251 |
SITE_FORM_SUBMIT_ELEMENT = '#INDEX_BT_LOGIN' |
252 | 252 | |
253 |
SITE_LOGOUT_LOCATOR = '#MENU_FAMILLE_QUITTER' |
|
254 | ||
253 | 255 | |
254 | 256 |
class ImuseTeacherMontpellier(Imuse): |
255 | 257 |
SITE_LOGIN_PATH = '/montpellier/extranet/login/ens_index_enseignant.php' |
mandayejs/mandaye/static/single.logout.js | ||
---|---|---|
1 |
$(function(){ |
|
2 |
if (typeof(mandaye_logout_locator) === 'undefined') |
|
3 |
return false; |
|
4 |
$(mandaye_logout_locator).click(function(){ |
|
5 |
console.log("launching slo"); |
|
6 |
$.get('/_mandaye/logout/', function(){}); |
|
7 |
}); |
|
8 |
}); |
mandayejs/mandaye/templates/mandaye/panel.html | ||
---|---|---|
3 | 3 |
<script type="text/javascript"> |
4 | 4 |
var mandaye_redirect_url = '{{force_redirect_url}}'; |
5 | 5 |
var mandaye_redirect_locator = '{{force_redirect_locator}}'; |
6 |
var mandaye_logout_locator = '{{logout_locator}}'; |
|
6 | 7 |
</script> |
7 | 8 | |
8 | 9 |
<script type="text/javascript" src="{% static 'force.redirect.js' %}"></script> |
10 |
<script type="text/javascript" src="{% static 'single.logout.js' %}"></script> |
|
9 | 11 | |
10 | 12 |
{% if site_scripts %} |
11 | 13 |
{%for script in site_scripts%} |
... | ... | |
23 | 25 |
{% if user.is_authenticated %} |
24 | 26 |
<div id="mandaye-username"><a href="{{idp_url}}/accounts">{{ user.get_full_name }}</a></div> |
25 | 27 |
<div id="mandaye-advances"><a href="{{wcs_url}}">{% trans 'advances' %}</a></div> |
26 |
<div id="mandaye-logon-url"><a href="{% url 'mellon_logout' %}">{% trans 'logout' %}</a></div>
|
|
28 |
<div id="mandaye-logon-url"><a href="{% url 'logout' %}">{% trans 'logout' %}</a></div> |
|
27 | 29 |
{% if is_linked %} |
28 | 30 |
<div id="mandaye-association-url"><a href="{% url 'dissociate' %}">{% trans 'dissociate' %}</a></div> |
29 | 31 |
{% else %} |
mandayejs/mandaye/views.py | ||
---|---|---|
44 | 44 |
from mandayejs.mandaye.utils import exec_phantom, cookie_builder, get_login_info |
45 | 45 |
from mandayejs.applications import get_app_settings |
46 | 46 | |
47 |
from mellon.views import logout as mellon_logout |
|
48 | ||
47 | 49 |
app_settings = get_app_settings() |
48 | 50 | |
49 | 51 |
logger = logging.getLogger(__name__) |
50 | 52 | |
51 |
def login(request, *args, **kwargs): |
|
52 |
return auth_views.login(request, *args, **kwargs) |
|
53 | ||
54 | 53 |
def logout(request, *args, **kwargs): |
55 |
auth_logout(request) |
|
56 |
return HttpResponseRedirect('/') |
|
54 |
logger.debug("running slo") |
|
55 |
response = mellon_logout(request, *args, **kwargs) |
|
56 |
for cookie in app_settings.SITE_AUTH_COOKIE_KEYS: |
|
57 |
response.delete_cookie(cookie) |
|
58 |
return response |
|
57 | 59 | |
58 | 60 | |
59 | 61 |
class Panel(TemplateView): |
... | ... | |
67 | 69 |
'SITE_FORCE_REDIRECT_URL', '') |
68 | 70 |
context['force_redirect_locator'] = getattr(app_settings, |
69 | 71 |
'SITE_FORCE_REDIRECT_LOCATOR', '') |
72 |
context['logout_locator'] = getattr(app_settings, |
|
73 |
'SITE_LOGOUT_LOCATOR','') |
|
70 | 74 |
context['is_linked'] = self.is_account_linked() |
71 | 75 |
return context |
72 | 76 |
mandayejs/urls.py | ||
---|---|---|
33 | 33 |
) |
34 | 34 | |
35 | 35 |
if 'mellon' in settings.INSTALLED_APPS: |
36 |
urlpatterns += patterns('', url(r'^_mandaye/accounts/mellon/', include('mellon.urls'))) |
|
36 |
urlpatterns += patterns('', |
|
37 |
url(r'^_mandaye/logout/$', 'mandayejs.mandaye.views.logout', name='logout'), |
|
38 |
url(r'^_mandaye/accounts/mellon/', include('mellon.urls')), |
|
39 |
) |
|
37 | 40 | |
38 |
- |