POC Campus Condorcet : ajout de la fonctionnalite "invitation a s'inscrire"

This commit is contained in:
Paul Marillonnet 2017-09-27 14:27:45 +02:00
parent 6f39c626e9
commit 77d171ada9
3 changed files with 7 additions and 8 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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):