From e975133f15174c4a2bf4e59c0c98e0781538440c Mon Sep 17 00:00:00 2001 From: Josue Kouka Date: Mon, 4 Jan 2016 12:17:38 +0100 Subject: [PATCH] handle form_submit_element key in login info (#9477) --- README | 7 +++++-- mandayejs/do_login.js | 2 +- mandayejs/mandaye/views.py | 3 ++- mandayejs/settings.py | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README b/README index 0a7f9e2..9a3a4bd 100644 --- a/README +++ b/README @@ -47,7 +47,6 @@ Example of local_settings.py SITE_DOMAIN = 'example.com' SITE_LOGIN_PATH = '/' - SITE_HOME_PATH = '/profile' # Not required SITE_CA_URL = 'https://myidp/account/' # Citizen account SITE_LOCATORS = [ @@ -94,13 +93,17 @@ Example of local_settings.py # // your code # } # - SITE_AUTH_CHECKER = 'js/vincennes_auth_checker.js' + SITE_AUTH_CHECKER = 'js/example.auth.checker.js' # JS/CSS for the association page (/_mandaye/associate) SITE_ASSOCIATE_STATIC = { 'css': 'css/example_associate.css', 'js': 'js/example_associate.js', } + + # DOM Element used to validate the logon form + # If not provided, default is 'input[type=submit], button' + SITE_FORM_SUBMIT_ELEMENT = 'button[type=submit]' # Mellon Settings MELLON_IDENTITY_PROVIDERS = [ diff --git a/mandayejs/do_login.js b/mandayejs/do_login.js index 34e4541..3fd4b26 100644 --- a/mandayejs/do_login.js +++ b/mandayejs/do_login.js @@ -57,6 +57,6 @@ page.open(input.address, function() { } } } - $(key).parents('form').find('input[type=submit]').click(); + $(key).parents('form').find(input.form_submit_element).click(); }, input); }); diff --git a/mandayejs/mandaye/views.py b/mandayejs/mandaye/views.py index bfc5293..02e507a 100644 --- a/mandayejs/mandaye/views.py +++ b/mandayejs/mandaye/views.py @@ -135,11 +135,12 @@ def post_login_do(request, *args, **kwargs): credentials = get_object_or_404(UserCredentials, user=request.user) site_static_root = os.path.join(getattr(settings, 'STATIC_ROOT'), getattr(settings, 'SITE_STATIC_ROOT_PATH', '')) site_auth_checker = getattr(settings, 'SITE_AUTH_CHECKER', '') + site_form_submit_element = getattr(settings, 'SITE_FORM_SUBMIT_ELEMENT', 'input[type=submit], button') login_info = { 'address': request.build_absolute_uri(settings.SITE_LOGIN_PATH), 'cookies': [], 'locators': [ credentials.to_login_info() ], - 'homepath': getattr(settings, 'SITE_HOME_PATH', '/'), + 'form_submit_element': site_form_submit_element, 'auth_checker': os.path.join(site_static_root, site_auth_checker) } logger.debug(login_info) diff --git a/mandayejs/settings.py b/mandayejs/settings.py index f45f9ea..1c3fa02 100644 --- a/mandayejs/settings.py +++ b/mandayejs/settings.py @@ -56,6 +56,7 @@ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'mandayejs.mandaye', 'mandayejs.sites.vincennes', + 'mandayejs.sites.montpellier3m', 'gadjo', 'mellon' ) -- 2.6.4