Jon Solow
commited on
Commit
Β·
2eee45f
1
Parent(s):
fac5a9c
Fix login locally at least
Browse files- src/login.py +2 -3
- src/pages/10_Set_Your_Lineup.py +2 -1
src/login.py
CHANGED
@@ -23,7 +23,7 @@ def get_password_from_user_id(user_id: int) -> str | None:
|
|
23 |
df_pass = conn.read(
|
24 |
worksheet=f"user-{user_id}",
|
25 |
usecols=[0],)
|
26 |
-
if df_pass:
|
27 |
return df_pass.password[0]
|
28 |
except:
|
29 |
return None
|
@@ -44,7 +44,6 @@ def check_password():
|
|
44 |
# check if email exists
|
45 |
if user_id:=get_user_id_from_email_if_exists(st.session_state["email"]):
|
46 |
if password:=get_password_from_user_id(user_id):
|
47 |
-
st.write(password)
|
48 |
if hmac.compare_digest(
|
49 |
st.session_state["password"],
|
50 |
password,
|
@@ -63,6 +62,6 @@ def check_password():
|
|
63 |
|
64 |
# Show inputs for email + password.
|
65 |
login_form()
|
66 |
-
if "password_correct"
|
67 |
st.error("π User not known or password incorrect")
|
68 |
return False
|
|
|
23 |
df_pass = conn.read(
|
24 |
worksheet=f"user-{user_id}",
|
25 |
usecols=[0],)
|
26 |
+
if len(df_pass):
|
27 |
return df_pass.password[0]
|
28 |
except:
|
29 |
return None
|
|
|
44 |
# check if email exists
|
45 |
if user_id:=get_user_id_from_email_if_exists(st.session_state["email"]):
|
46 |
if password:=get_password_from_user_id(user_id):
|
|
|
47 |
if hmac.compare_digest(
|
48 |
st.session_state["password"],
|
49 |
password,
|
|
|
62 |
|
63 |
# Show inputs for email + password.
|
64 |
login_form()
|
65 |
+
if st.session_state.get("password_correct", True) == False:
|
66 |
st.error("π User not known or password incorrect")
|
67 |
return False
|
src/pages/10_Set_Your_Lineup.py
CHANGED
@@ -76,8 +76,9 @@ def get_page():
|
|
76 |
st.set_page_config(page_title=page_title, page_icon=DEFAULT_ICON, layout="wide")
|
77 |
common_page_config()
|
78 |
st.title(page_title)
|
79 |
-
if not check_password:
|
80 |
st.write("Sorry, you must be logged in first to play")
|
|
|
81 |
|
82 |
qb_options, wr_options, rb_options, te_options, k_options, df_rosters = load_options()
|
83 |
|
|
|
76 |
st.set_page_config(page_title=page_title, page_icon=DEFAULT_ICON, layout="wide")
|
77 |
common_page_config()
|
78 |
st.title(page_title)
|
79 |
+
if not check_password():
|
80 |
st.write("Sorry, you must be logged in first to play")
|
81 |
+
st.stop()
|
82 |
|
83 |
qb_options, wr_options, rb_options, te_options, k_options, df_rosters = load_options()
|
84 |
|