mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-10 19:34:27 -04:00
Fix issue where exception thrown when user does not activate email but successfully completes forgotten-password flow (which includes 2f)
This commit is contained in:
@@ -28,7 +28,6 @@ from app.main.forms import LoginForm
|
||||
|
||||
@main.route('/sign-in', methods=(['GET', 'POST']))
|
||||
def sign_in():
|
||||
|
||||
if current_user and current_user.is_authenticated:
|
||||
return redirect(url_for('main.choose_service'))
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ def two_factor():
|
||||
form = TwoFactorForm(_check_code)
|
||||
|
||||
if form.validate_on_submit():
|
||||
import pdb; pdb.set_trace()
|
||||
try:
|
||||
user = user_api_client.get_user(user_id)
|
||||
services = service_api_client.get_services({'user_id': str(user_id)}).get('data', [])
|
||||
@@ -32,7 +33,9 @@ def two_factor():
|
||||
user.set_password(session['user_details']['password'])
|
||||
user.reset_failed_login_count()
|
||||
user_api_client.update_user(user)
|
||||
login_user(user, remember=True)
|
||||
|
||||
activated_user = user_api_client.activate_user(user)
|
||||
login_user(activated_user, remember=True)
|
||||
finally:
|
||||
del session['user_details']
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ def user_has_permissions(*permissions, admin_override=False, any_=False):
|
||||
def redirect_to_sign_in(f):
|
||||
@wraps(f)
|
||||
def wrapped(*args, **kwargs):
|
||||
import pdb; pdb.set_trace()
|
||||
if 'user_details' not in session:
|
||||
return redirect(url_for('main.sign_in'))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user