After investigating a 500 in the admin app, I found an edge case in the invitation registration flow that can cause an error.

The flow is as follows:
If the invited user clicks on the /invitation/<token> link in the email (now on /register-from-invite),
then goes to another browser and registers for Notify.
Coming back to the other browser, submit the form for /register-from-invite.

This PR fixes that bug and adds a couple tests for register_from_invite
This commit is contained in:
Rebecca Law
2016-12-22 11:43:11 +00:00
parent 01b9aad0fb
commit 7b54e0c463
2 changed files with 54 additions and 2 deletions

View File

@@ -80,8 +80,8 @@ def _do_registration(form, service=None, send_sms=True, send_email=True):
session['expiry_date'] = str(datetime.utcnow() + timedelta(hours=1))
session['user_details'] = {"email": user.email_address, "id": user.id}
else:
user = user_api_client.get_user_by_email(form.email_address.data)
if send_email:
user = user_api_client.get_user_by_email(form.email_address.data)
user_api_client.send_already_registered_email(user.id, user.email_address)
session['expiry_date'] = str(datetime.utcnow() + timedelta(hours=1))
session['user_details'] = {"email": user.email_address, "id": user.id}