From 3c60b966cf9ba2669c70077a1af008ce04405ca6 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Thu, 2 Nov 2023 09:59:54 +0000 Subject: [PATCH] update auth --- src/auth.py | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/auth.py b/src/auth.py index d41bc04..4e5a694 100644 --- a/src/auth.py +++ b/src/auth.py @@ -34,7 +34,6 @@ def check_password(): unsafe_allow_html=True, ) - auth0_logged = False password_logged = False @@ -54,24 +53,24 @@ def check_password(): else: auth0_logged = True - if "password_correct" not in st.session_state: - # First run, show input for password. - st.text_input( - "Password", type="password", on_change=password_entered, key="password", autocomplete="current-password" - ) - - elif not st.session_state["password_correct"]: - # Password not correct, show input + error. - st.text_input( - "Password", type="password", on_change=password_entered, key="password", autocomplete="current-password" - ) - st.error("😕 Password incorrect") + if not auth0_logged: + if "password_correct" not in st.session_state: + # First run, show input for password. + st.text_input( + "Password", type="password", on_change=password_entered, key="password", autocomplete="current-password" + ) - else: - # Password correct, show success message. - st.success("🔒 Password correct") - password_logged = True + elif not st.session_state["password_correct"]: + # Password not correct, show input + error. + st.text_input( + "Password", type="password", on_change=password_entered, key="password", autocomplete="current-password" + ) + st.error("😕 Password incorrect") + else: + # Password correct, show success message. + st.success("🔒 Password correct") + password_logged = True if auth0_logged or password_logged: return True