summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Marillonnet <pmarillonnet@entrouvert.com>2017-09-28 14:22:09 (GMT)
committerPaul Marillonnet <pmarillonnet@entrouvert.com>2017-09-28 14:22:09 (GMT)
commite5819877a3d8fc5145bf8b1c352a6fead35dbf90 (patch)
treec339bb490d9ed1f9195625abe66a890e1a682005
parent937c99df7d32e8895a5da7dce06dbee70debb34b (diff)
downloadpaul-synchro-e5819877a3d8fc5145bf8b1c352a6fead35dbf90.zip
paul-synchro-e5819877a3d8fc5145bf8b1c352a6fead35dbf90.tar.gz
paul-synchro-e5819877a3d8fc5145bf8b1c352a6fead35dbf90.tar.bz2
POC Campus Condorcet : affichage de la description de l'etablissement de l'invite
-rw-r--r--django/sp_sso/saml/views.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/django/sp_sso/saml/views.py b/django/sp_sso/saml/views.py
index 02d0eba..dde316e 100644
--- a/django/sp_sso/saml/views.py
+++ b/django/sp_sso/saml/views.py
@@ -5,7 +5,9 @@ from django.utils.translation import ugettext_lazy as _, ugettext as ugt
from .forms import RegistrationForm
from .utils import ldap_contains_user, wcs_submit, sso_attributes, \
craft_user_nickname, generate_eppn, \
- initial_from_tracking_code, render_message
+ initial_from_tracking_code, render_message, \
+ ldap_get_description_etablissements
+
MSG_WCS_POST = _("""Your account creation request has been sent. An
@@ -64,6 +66,10 @@ class RegistrationFormView(FormView):
attribute_element = data.get(attribute)[0]
initial[attribute] = attribute_element
initial['user_nickname'] = craft_user_nickname(data)
+ if data.get('s_etablissement', [None])[0]:
+ self.request.session['code_etablissement'] = data.get('s_etablissement')[0]
+ initial['s_etablissement'] = ldap_get_description_etablissements(
+ data.get('s_etablissement')[0])
initial['yet_member'] = False
return initial
@@ -97,5 +103,8 @@ class RegistrationFormView(FormView):
wcs_rest_data['ep_principal_name'] = generate_eppn(
post_dict.get('nom',''))
+ if self.request.session.get('code_etablissement'):
+ wcs_rest_data['s_etablissement'] = self.request.session['code_etablissement']
+
wcs_submit(wcs_rest_data, posturl)
return super(RegistrationFormView, self).form_valid(form)