mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
when not logged in, redirect to sign-in
parts of the initial setup/login stages were throwing 500s if user not already in process (ie: user directly navigated to url): * /resend-email-verification * /text-not-received * /send-new-code * verify
This commit is contained in:
@@ -9,17 +9,14 @@ from flask import (
|
||||
from flask_login import login_user, current_user
|
||||
from app.main import main
|
||||
from app.main.forms import TwoFactorForm
|
||||
from app import service_api_client
|
||||
from app import user_api_client
|
||||
from app import service_api_client, user_api_client
|
||||
from app.utils import redirect_to_sign_in
|
||||
|
||||
|
||||
@main.route('/two-factor', methods=['GET', 'POST'])
|
||||
@redirect_to_sign_in
|
||||
def two_factor():
|
||||
# TODO handle user_email not in session
|
||||
try:
|
||||
user_id = session['user_details']['id']
|
||||
except KeyError:
|
||||
return redirect(url_for('main.sign_in'))
|
||||
user_id = session['user_details']['id']
|
||||
|
||||
def _check_code(code):
|
||||
return user_api_client.check_verify_code(user_id, code, "sms")
|
||||
|
||||
Reference in New Issue
Block a user