From 0d38acd7fa001f0a37409b146d3afa71f091dfb5 Mon Sep 17 00:00:00 2001 From: Paul Marillonnet Date: Tue, 26 Sep 2017 10:54:22 +0200 Subject: [PATCH] POC Campus Condorcet : membre et affiliate comme profils possibles --- django/sp_sso/saml/forms.py | 7 +++++++ django/sp_sso/saml/views.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/django/sp_sso/saml/forms.py b/django/sp_sso/saml/forms.py index d8ac38a..9b5906b 100644 --- a/django/sp_sso/saml/forms.py +++ b/django/sp_sso/saml/forms.py @@ -85,6 +85,13 @@ class RegistrationForm(forms.Form): if field in sso_strict_readonly_attributes: self.fields[field].widget.attrs['readonly'] = True + if kwargs['initial'].get('yet_member', '') is False: + additional_choice = (('affiliate', _('Affiliate')),) + else: + additional_choice = (('member', _('Member')),) + actual_affiliation_choices = AFFILIATION_CHOICES + additional_choice + self.fields['ep_primary_affiliation'].choices = actual_affiliation_choices + nom = forms.CharField(max_length=100, label=_("Last name")) prenom = forms.CharField(max_length=100, label=_("First name")) email = forms.CharField(max_length=100, label=_("Email address")) diff --git a/django/sp_sso/saml/views.py b/django/sp_sso/saml/views.py index a142efa..02d0eba 100644 --- a/django/sp_sso/saml/views.py +++ b/django/sp_sso/saml/views.py @@ -64,7 +64,7 @@ class RegistrationFormView(FormView): attribute_element = data.get(attribute)[0] initial[attribute] = attribute_element initial['user_nickname'] = craft_user_nickname(data) - + initial['yet_member'] = False return initial def form_valid(self, form):