From 6e82eeef5e7a7a2eafd7b4bc36b634106c0fe8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= Date: Fri, 5 Sep 2014 19:21:48 +0200 Subject: [PATCH] arcopole: finilize toolbar and fixing last bugs --- mandaye_cud/config.py | 1 + mandaye_cud/default-config.ini | 1 + mandaye_cud/filters/cud.py | 7 +++ mandaye_cud/mappers/arcopole.py | 48 ++++++++++++------- mandaye_cud/templates/arcopole/associate.html | 15 ++---- mandaye_cud/templates/toolbar.html | 8 +++- 6 files changed, 50 insertions(+), 30 deletions(-) diff --git a/mandaye_cud/config.py b/mandaye_cud/config.py index 94b96aa..f7b6244 100644 --- a/mandaye_cud/config.py +++ b/mandaye_cud/config.py @@ -133,6 +133,7 @@ use_long_trace = config.getboolean('debug', 'use_long_trace') auto_decompress = config.getboolean('mandaye', 'auto_decompress') # Ask mandaye to add a toolbar with Mandaye's links mandaye_toolbar = config.getboolean('mandaye', 'toolbar') +mandaye_offline_toolbar = config.getboolean('mandaye', 'offline_toolbar') # Authentic 2 auto connection a2_auto_connection = config.getboolean('mandaye', 'a2_auto_connection') diff --git a/mandaye_cud/default-config.ini b/mandaye_cud/default-config.ini index e318d08..ad4275d 100644 --- a/mandaye_cud/default-config.ini +++ b/mandaye_cud/default-config.ini @@ -24,6 +24,7 @@ sentry_dsn: [mandaye] toolbar: true +offline_toolbar: true a2_auto_connection: false ; only sql at the moment storage_backend: sql diff --git a/mandaye_cud/filters/cud.py b/mandaye_cud/filters/cud.py index 458e205..767ec07 100644 --- a/mandaye_cud/filters/cud.py +++ b/mandaye_cud/filters/cud.py @@ -9,3 +9,10 @@ class ArcopoleFilter: response.msg = associate return response + @staticmethod + def is_action_logout(env, request, response): + request.msg = request.msg.read() + if "logout" in request.msg: + return True + return False + diff --git a/mandaye_cud/mappers/arcopole.py b/mandaye_cud/mappers/arcopole.py index 9deb06b..06c55ed 100644 --- a/mandaye_cud/mappers/arcopole.py +++ b/mandaye_cud/mappers/arcopole.py @@ -27,19 +27,20 @@ from mandaye_cud.filters.cud import ArcopoleFilter from mandaye.filters.default import MandayeFilter form_values = { - 'login_url': '/studio/accueil?callback=mamaman', + 'login_url': '/studio/accueil?callback=acallback', + 'post_url': '/studio/login?callback=acallback', 'form_attrs': { 'id': 'login-form' }, 'post_fields': ['username', 'password'], 'username_field': 'username', 'password_field': 'password', -} + } urls = { - 'associate_url': '/studio/mandayeassociate', - 'connection_url': '/mandaye/sso', - 'disassociate_url': '/mandaye/disassociate', - 'login_url': '/mandaye/login' -} + 'associate_url': '/studio/mandayeassociate', + 'connection_url': '/mandaye/sso', + 'disassociate_url': '/mandaye/disassociate', + 'login_url': '/mandaye/login' + } mapping = [ { @@ -62,11 +63,25 @@ mapping = [ 'method': 'GET', 'response': {'auth': 'sso',} }, + { + 'path': r'/studio/locallogout$', + 'method': 'GET', + 'response': {'auth': 'local_logout', 'values': {'next_url': '/studio/accueil'}} + }, { 'path': r'/mandaye/slo$', 'method': 'GET', 'response': {'auth': 'slo',} - }, + }, + { + 'path': r'/mandaye/disassociate$', + 'method': 'GET', + 'response': { + 'auth': 'disassociate', + 'values': {'next_url': '/studio/locallogout',}, + } + }, + { 'path': r'/studio/mandayeassociate$', 'method': 'GET', @@ -76,21 +91,20 @@ mapping = [ 'values': { 'action': urls['associate_url'], 'template': 'arcopole/associate.html', - 'sp_name': 'Arcopole', - 'login_name': form_values['username_field'], - 'password_name': form_values['password_field'], }, },] }, { - 'path': r'/studio/mandayeassociate$', - 'method': 'POST', - 'response': { - 'auth': 'associate_submit', - 'values': {'condition': "'success' in response.msg"} + 'path': r'/studio/mandayeassociate$', + 'method': 'POST', + 'response': { + 'auth': 'associate_submit', + 'values': { + 'condition': "'success' in response.msg", + } + }, }, - }, { 'path': r'%s$' % END_POINTS_PATH['single_sign_on_post'], 'method': 'POST', diff --git a/mandaye_cud/templates/arcopole/associate.html b/mandaye_cud/templates/arcopole/associate.html index 0ee1dfc..825ae2e 100644 --- a/mandaye_cud/templates/arcopole/associate.html +++ b/mandaye_cud/templates/arcopole/associate.html @@ -163,17 +163,6 @@ function majApplications() { // User messages var msgStart = "
"; var msgEnd ="
"; - if (n == 0) - { - if ($('#userinfo-username').html() == "") - { - $('#arcopole-app').html(msgStart + "Aucune application accessible, veuillez vous connecter" + msgEnd); - } - else - { - $('#arcopole-app').html(msgStart + "Aucune application disponible" + msgEnd); - } - } // un appid a ete fourni ? et l'authentification n'est pas requise ? // attention un mix de jsp (server) et javascript ( client )!!! @@ -234,6 +223,8 @@ function load() { majUserInfo(); } + + @@ -276,7 +267,7 @@ function load() {
-
+

Veuillez saisir votre identifiant et votre mot de passe afin de les associer avec votre compte partenaire.

diff --git a/mandaye_cud/templates/toolbar.html b/mandaye_cud/templates/toolbar.html index 7a8b9e9..b99d040 100644 --- a/mandaye_cud/templates/toolbar.html +++ b/mandaye_cud/templates/toolbar.html @@ -8,12 +8,18 @@