Commit 072b84a7 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Keep third party token between signup form errors

parent ec7ef453
......@@ -171,7 +171,7 @@ class ShibbolethTests(TestCase):
r = client.get('/im/shibboleth/signup/%s' % token)
form = r.context['form']
post_data = {'email': 'kpap@grnet.gr',
post_data = {'email': 'kpap',
'third_party_identifier': pending_user.third_party_identifier,
'first_name': 'Kostas',
'third_party_token': token,
......@@ -180,6 +180,9 @@ class ShibbolethTests(TestCase):
'provider': 'shibboleth'
}
r = client.post('/im/signup', post_data)
self.assertContains(r, token)
post_data['email'] = 'kpap@grnet.gr'
r = client.post('/im/signup', post_data)
self.assertEqual(r.status_code, 200)
self.assertEqual(AstakosUser.objects.count(), 1)
self.assertEqual(PendingThirdPartyUser.objects.count(), 0)
......
......@@ -410,6 +410,8 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
except AstakosUser.DoesNotExist:
instance = None
third_party_token = request.REQUEST.get('third_party_token', None)
try:
if not backend:
backend = get_backend(request)
......@@ -464,6 +466,7 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
transaction.rollback()
return render_response(template_name,
signup_form=form,
third_party_token=third_party_token,
provider=provider,
context_instance=get_context(request, extra_context))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment