Do not verify sms for pending users with email auth

This is to fix a bug where a user creates an account but doesn't
complete registration, then they are invited to a service that
changes their auth to email_auth, and then when they try to
complete registration they are still asked for sms code.

It should save users some pain, and reduce number of support tickets.
This commit is contained in:
Pea Tyczynska
2022-02-23 17:42:49 +00:00
committed by Leo Hemsted
parent 262e2ba6e7
commit 8112930e24
2 changed files with 61 additions and 0 deletions

View File

@@ -63,6 +63,13 @@ def verify_email(token):
return redirect(url_for('main.sign_in'))
session['user_details'] = {"email": user.email_address, "id": user.id}
if user.auth_type == 'email_auth':
try:
return activate_user(user.id)
finally:
session.pop('user_details', None)
user.send_verify_code()
return redirect(url_for('main.verify'))