mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
make some progress
This commit is contained in:
@@ -12,7 +12,7 @@ from flask import (
|
||||
)
|
||||
from flask_login import current_user
|
||||
|
||||
from app import login_manager
|
||||
from app import login_manager, user_api_client
|
||||
from app.main import main
|
||||
from app.main.forms import LoginForm
|
||||
from app.main.views.verify import activate_user
|
||||
@@ -24,16 +24,13 @@ from app.utils.login import is_safe_redirect_url
|
||||
@main.route("/sign-in", methods=(["GET", "POST"]))
|
||||
@hide_from_search_engines
|
||||
def sign_in():
|
||||
|
||||
redirect_url = request.args.get("next")
|
||||
|
||||
# TODO this is not the right test to do to find test users
|
||||
if os.getenv("NOTIFY_E2E_TEST_EMAIL") == 'ken.kehl@fedramp.gov':
|
||||
user_id = session["user_details"]["id"]
|
||||
activate_user(user_id)
|
||||
return redirect(
|
||||
url_for("main.show_accounts_or_dashboard", next=redirect_url)
|
||||
)
|
||||
if os.getenv("NOTIFY_E2E_TEST_EMAIL") == "ken.kehl@fedramp.gov":
|
||||
user = user_api_client.get_user_by_email("ken.kehl@fedramp.gov")
|
||||
activate_user(user["id"])
|
||||
return redirect(url_for("main.show_accounts_or_dashboard", next=redirect_url))
|
||||
|
||||
if current_user and current_user.is_authenticated:
|
||||
if redirect_url and is_safe_redirect_url(redirect_url):
|
||||
@@ -68,7 +65,7 @@ def sign_in():
|
||||
invited_user.accept_invite()
|
||||
|
||||
# TODO this is not the right test to do to find test users
|
||||
if os.getenv("NOTIFY_E2E_TEST_EMAIL") == 'ken.kehl@fedramp.gov':
|
||||
if os.getenv("NOTIFY_E2E_TEST_EMAIL") == "ken.kehl@fedramp.gov":
|
||||
user_id = session["user_details"]["id"]
|
||||
activate_user(user_id)
|
||||
return redirect(
|
||||
@@ -78,10 +75,8 @@ def sign_in():
|
||||
user.send_login_code()
|
||||
|
||||
if user.sms_auth:
|
||||
|
||||
return redirect(url_for(".two_factor_sms", next=redirect_url))
|
||||
|
||||
|
||||
if user.email_auth:
|
||||
return redirect(
|
||||
url_for(".two_factor_email_sent", next=redirect_url)
|
||||
|
||||
@@ -16,9 +16,6 @@ from app.utils.login import redirect_to_sign_in
|
||||
def verify():
|
||||
user_id = session["user_details"]["id"]
|
||||
|
||||
print(f"RETURN ABRUPT WITH ACTIVATE USER")
|
||||
return activate_user(user_id)
|
||||
|
||||
def _check_code(code):
|
||||
return user_api_client.check_verify_code(user_id, code, "sms")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user