<p class="hint">Enter your Institution name</p>
<?php echo $erraffiliation;?>
</div>
+
+ <div class="field">
+ <label for="auth_list">Authority</label>
+ <select id="auth_list" name="authority_hrn" size="1" class="required">
+ {% for authority in authorities %}
+ <option value="{{ authority.authority_hrn }}"/>{{authority.name}} ({{authority.authority_hrn}})</option>
+ {% endfor %}
+ </select>
+ <p class="hint">Please select an authority responsible for vetting your account</p>
+ </div>
+
<div class="field">
<label for="cemail">Email</label>
<input type="text" id="email" name="email" size="25" class="required email" value="{{ email }}"/>
def register_4m_f4f(request):
errors = []
+
+ authorities_query = Query.get('authority').filter_by('authority_hrn', 'included', ['ple.inria', 'ple.upmc']).select('name', 'authority_hrn')
+ #authorities_query = Query.get('authority').select('authority_hrn')
+ authorities = execute_query(request, authorities_query)
+
if request.method == 'POST':
#get_email = PendingUser.objects.get(email)
reg_fname = request.POST.get('firstname', '')
reg_lname = request.POST.get('lastname', '')
reg_aff = request.POST.get('affiliation','')
+ reg_auth = request.POST.get('authority_hrn', '')
reg_email = request.POST.get('email','').lower()
#POST value validation
errors.append('Affiliation may contain only letters, numbers, spaces and @/./+/-/_ characters.')
#return HttpResponse("Only Letters, Numbers and _ is allowed in Affiliation")
#return render(request, 'register_4m_f4f.html')
+ # XXX validate authority hrn !!
if PendingUser.objects.filter(email__iexact=reg_email):
errors.append('Email already registered.Please provide a new email address.')
#return HttpResponse("Email Already exists")
#b.save()
if not errors:
b = PendingUser(first_name=reg_fname, last_name=reg_lname, affiliation=reg_aff,
+ authority_hrn=reg_auth,
email=reg_email, password=request.POST['password'], keypair=keypair)
b.save()
return render(request, 'user_register_complete.html')
'firstname': request.POST.get('firstname', ''),
'lastname': request.POST.get('lastname', ''),
'affiliation': request.POST.get('affiliation', ''),
+ 'authority_hrn': request.POST.get('authority_hrn', ''),
'email': request.POST.get('email', ''),
'password': request.POST.get('password', ''),
+ 'authorities': authorities
})
for user in pending_users:
auth_hrn = user.authority_hrn
- if not auth_hrn:
- auth_hrn = "fed4fire.upmc" # XXX HARDCODED
request = {}
request['type'] = 'user'