summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Marillonnet <pmarillonnet@entrouvert.com>2017-09-27 12:27:45 (GMT)
committerPaul Marillonnet <pmarillonnet@entrouvert.com>2017-09-27 12:27:45 (GMT)
commit77d171ada905e9f098d29577966b9f41b30be014 (patch)
treec71f2e7cf19e03e00c5c54038dd761781b8c63ca
parent6f39c626e9854e23e7402a6c0b3cd9111737ab88 (diff)
downloadpaul-synchro-77d171ada905e9f098d29577966b9f41b30be014.zip
paul-synchro-77d171ada905e9f098d29577966b9f41b30be014.tar.gz
paul-synchro-77d171ada905e9f098d29577966b9f41b30be014.tar.bz2
POC Campus Condorcet : ajout de la fonctionnalite "invitation a s'inscrire"
-rw-r--r--django/sp_sso/invite/forms.py2
-rw-r--r--django/sp_sso/invite/views.py9
-rw-r--r--django/sp_sso/saml/decorators.py4
3 files changed, 7 insertions, 8 deletions
diff --git a/django/sp_sso/invite/forms.py b/django/sp_sso/invite/forms.py
index 9d0ea58..01eb5e9 100644
--- a/django/sp_sso/invite/forms.py
+++ b/django/sp_sso/invite/forms.py
@@ -81,4 +81,4 @@ class InvitationForm(forms.Form):
max_length=100, label=_("Your email address"))
hote_type = forms.CharField(
- max_length=100, label="hidden host type", initial='affiliate', required=False)
+ max_length=100, label="hidden host type", required=False)
diff --git a/django/sp_sso/invite/views.py b/django/sp_sso/invite/views.py
index 9b714a0..e446522 100644
--- a/django/sp_sso/invite/views.py
+++ b/django/sp_sso/invite/views.py
@@ -46,16 +46,11 @@ class InvitationFormView(FormView):
if data.get(attribute_key):
attribute_element = data.get(attribute_key)[0]
initial[attribute_value] = attribute_element
- if self.request.GET.get('type'):
- initial['hote_type'] = self.request.GET.get('type')
- #etablissement, unite = get_affectations_from_eppn(
- # data.get('ep_principal_name',[None])[0])
-
- #initial['hote_etablissement'] = etablissement
- #initial['hote_unite'] = unite
initial['hote_commentaire'] = '''EduPersonPrincipalName de
l\'invitant'''
+
+ initial['hote_type'] = self.request.session.get('host_type')
return initial
def form_valid(self, form):
diff --git a/django/sp_sso/saml/decorators.py b/django/sp_sso/saml/decorators.py
index f923899..ccf03f3 100644
--- a/django/sp_sso/saml/decorators.py
+++ b/django/sp_sso/saml/decorators.py
@@ -38,6 +38,10 @@ def user_in_ldap(function):
"""
def wrapped(request, *args, **kwargs):
if not 'mellon_session' in request.session:
+ if request.GET.get('host_type') == 'member':
+ request.session['host_type'] = 'member'
+ else:
+ request.session['host_type'] = 'affiliate'
return redirect(reverse('auth_login') + "?next=/invite/")
user_data = saml_collect_data(request)
if not ldap_contains_user(user_data):