Skip to content

Commit 5c86fc6

Browse files
committed
forward if no email to send
1 parent 6cb9aa3 commit 5c86fc6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

components/Auth.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,20 @@ def get_user():
161161
if confirm_button:
162162
otp = pyotp.TOTP(mfa_token).verify(mfa_confirm)
163163
if otp:
164-
_ = requests.post(
164+
response = requests.post(
165165
f"{auth_uri}/v1/login",
166166
json={"email": st.session_state["email"], "token": mfa_confirm},
167167
)
168+
if response.status_code == 200:
169+
data = response.json()
170+
if "detail" in data:
171+
new_uri = data["detail"]
172+
if data["detail"].startswith("http"):
173+
st.markdown(
174+
f'<meta http-equiv="refresh" content="0;URL={new_uri}">',
175+
unsafe_allow_html=True,
176+
)
177+
st.stop()
168178
st.session_state["mfa_confirmed"] = True
169179
if "otp_uri" in st.session_state:
170180
del st.session_state["otp_uri"]

0 commit comments

Comments
 (0)