Jon Solow
commited on
Commit
·
fac5a9c
1
Parent(s):
1c44794
Add login connected to gsheets
Browse files- dev-requirements.txt +61 -10
- pyproject.toml +1 -0
- requirements.txt +61 -9
- src/login.py +68 -0
- src/pages/10_Set_Your_Lineup.py +3 -0
dev-requirements.txt
CHANGED
@@ -30,8 +30,8 @@ babel==2.13.1
|
|
30 |
# via jupyterlab-server
|
31 |
beautifulsoup4==4.12.2
|
32 |
# via
|
33 |
-
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
34 |
# nbconvert
|
|
|
35 |
black==23.11.0
|
36 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
37 |
bleach==6.1.0
|
@@ -39,7 +39,9 @@ bleach==6.1.0
|
|
39 |
blinker==1.7.0
|
40 |
# via streamlit
|
41 |
cachetools==5.3.2
|
42 |
-
# via
|
|
|
|
|
43 |
certifi==2023.11.17
|
44 |
# via
|
45 |
# httpcore
|
@@ -60,11 +62,15 @@ comm==0.2.0
|
|
60 |
debugpy==1.8.0
|
61 |
# via ipykernel
|
62 |
decorator==5.1.1
|
63 |
-
# via
|
|
|
|
|
64 |
defusedxml==0.7.1
|
65 |
# via nbconvert
|
66 |
duckdb==0.9.2
|
67 |
-
# via
|
|
|
|
|
68 |
executing==2.0.1
|
69 |
# via stack-data
|
70 |
fastjsonschema==2.19.0
|
@@ -75,6 +81,27 @@ gitdb==4.0.11
|
|
75 |
# via gitpython
|
76 |
gitpython==3.1.40
|
77 |
# via streamlit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
h11==0.14.0
|
79 |
# via httpcore
|
80 |
html5lib==1.1
|
@@ -222,13 +249,15 @@ notebook-shim==0.2.3
|
|
222 |
# notebook
|
223 |
numpy==1.26.2
|
224 |
# via
|
225 |
-
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
226 |
# altair
|
|
|
227 |
# pandas
|
228 |
# pandas-stubs
|
229 |
# pyarrow
|
230 |
# pydeck
|
231 |
# streamlit
|
|
|
|
|
232 |
overrides==7.4.0
|
233 |
# via jupyter-server
|
234 |
packaging==23.2
|
@@ -244,10 +273,13 @@ packaging==23.2
|
|
244 |
# qtconsole
|
245 |
# qtpy
|
246 |
# streamlit
|
247 |
-
pandas==
|
248 |
# via
|
249 |
-
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
250 |
# altair
|
|
|
|
|
|
|
|
|
251 |
# streamlit
|
252 |
pandas-stubs==2.1.1.230928
|
253 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
@@ -285,6 +317,12 @@ pure-eval==0.2.2
|
|
285 |
# via stack-data
|
286 |
pyarrow==14.0.1
|
287 |
# via streamlit
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
pycparser==2.21
|
289 |
# via cffi
|
290 |
pydantic==2.5.2
|
@@ -335,7 +373,10 @@ referencing==0.31.1
|
|
335 |
requests==2.31.0
|
336 |
# via
|
337 |
# jupyterlab-server
|
|
|
338 |
# streamlit
|
|
|
|
|
339 |
rfc3339-validator==0.1.4
|
340 |
# via
|
341 |
# jsonschema
|
@@ -350,6 +391,8 @@ rpds-py==0.13.2
|
|
350 |
# via
|
351 |
# jsonschema
|
352 |
# referencing
|
|
|
|
|
353 |
ruff==0.1.6
|
354 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
355 |
send2trash==1.8.2
|
@@ -358,6 +401,7 @@ six==1.16.0
|
|
358 |
# via
|
359 |
# asttokens
|
360 |
# bleach
|
|
|
361 |
# html5lib
|
362 |
# python-dateutil
|
363 |
# rfc3339-validator
|
@@ -370,11 +414,18 @@ sniffio==1.3.0
|
|
370 |
# httpx
|
371 |
soupsieve==2.5
|
372 |
# via beautifulsoup4
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
stack-data==0.6.3
|
374 |
# via ipython
|
375 |
streamlit==1.29.0
|
376 |
# via
|
377 |
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
|
|
378 |
# streamlit-oauth
|
379 |
streamlit-oauth==0.1.5
|
380 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
@@ -432,8 +483,6 @@ typing-extensions==4.8.0
|
|
432 |
# pydantic
|
433 |
# pydantic-core
|
434 |
# streamlit
|
435 |
-
tzdata==2023.3
|
436 |
-
# via pandas
|
437 |
tzlocal==5.2
|
438 |
# via streamlit
|
439 |
uri-template==1.3.0
|
@@ -443,7 +492,9 @@ urllib3==2.1.0
|
|
443 |
# requests
|
444 |
# types-requests
|
445 |
validators==0.22.0
|
446 |
-
# via
|
|
|
|
|
447 |
watchdog==3.0.0
|
448 |
# via streamlit
|
449 |
wcwidth==0.2.12
|
|
|
30 |
# via jupyterlab-server
|
31 |
beautifulsoup4==4.12.2
|
32 |
# via
|
|
|
33 |
# nbconvert
|
34 |
+
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
35 |
black==23.11.0
|
36 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
37 |
bleach==6.1.0
|
|
|
39 |
blinker==1.7.0
|
40 |
# via streamlit
|
41 |
cachetools==5.3.2
|
42 |
+
# via
|
43 |
+
# google-auth
|
44 |
+
# streamlit
|
45 |
certifi==2023.11.17
|
46 |
# via
|
47 |
# httpcore
|
|
|
62 |
debugpy==1.8.0
|
63 |
# via ipykernel
|
64 |
decorator==5.1.1
|
65 |
+
# via
|
66 |
+
# gspread-pandas
|
67 |
+
# ipython
|
68 |
defusedxml==0.7.1
|
69 |
# via nbconvert
|
70 |
duckdb==0.9.2
|
71 |
+
# via
|
72 |
+
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
73 |
+
# st-gsheets-connection
|
74 |
executing==2.0.1
|
75 |
# via stack-data
|
76 |
fastjsonschema==2.19.0
|
|
|
81 |
# via gitpython
|
82 |
gitpython==3.1.40
|
83 |
# via streamlit
|
84 |
+
google-auth==2.26.1
|
85 |
+
# via
|
86 |
+
# google-auth-oauthlib
|
87 |
+
# gspread
|
88 |
+
# gspread-pandas
|
89 |
+
google-auth-oauthlib==1.2.0
|
90 |
+
# via
|
91 |
+
# gspread
|
92 |
+
# gspread-pandas
|
93 |
+
gspread==5.12.4
|
94 |
+
# via
|
95 |
+
# gspread-dataframe
|
96 |
+
# gspread-formatting
|
97 |
+
# gspread-pandas
|
98 |
+
# st-gsheets-connection
|
99 |
+
gspread-dataframe==3.3.1
|
100 |
+
# via st-gsheets-connection
|
101 |
+
gspread-formatting==1.1.2
|
102 |
+
# via st-gsheets-connection
|
103 |
+
gspread-pandas==3.2.3
|
104 |
+
# via st-gsheets-connection
|
105 |
h11==0.14.0
|
106 |
# via httpcore
|
107 |
html5lib==1.1
|
|
|
249 |
# notebook
|
250 |
numpy==1.26.2
|
251 |
# via
|
|
|
252 |
# altair
|
253 |
+
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
254 |
# pandas
|
255 |
# pandas-stubs
|
256 |
# pyarrow
|
257 |
# pydeck
|
258 |
# streamlit
|
259 |
+
oauthlib==3.2.2
|
260 |
+
# via requests-oauthlib
|
261 |
overrides==7.4.0
|
262 |
# via jupyter-server
|
263 |
packaging==23.2
|
|
|
273 |
# qtconsole
|
274 |
# qtpy
|
275 |
# streamlit
|
276 |
+
pandas==1.5.3
|
277 |
# via
|
|
|
278 |
# altair
|
279 |
+
# gspread-dataframe
|
280 |
+
# gspread-pandas
|
281 |
+
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
282 |
+
# st-gsheets-connection
|
283 |
# streamlit
|
284 |
pandas-stubs==2.1.1.230928
|
285 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
|
|
317 |
# via stack-data
|
318 |
pyarrow==14.0.1
|
319 |
# via streamlit
|
320 |
+
pyasn1==0.5.1
|
321 |
+
# via
|
322 |
+
# pyasn1-modules
|
323 |
+
# rsa
|
324 |
+
pyasn1-modules==0.3.0
|
325 |
+
# via google-auth
|
326 |
pycparser==2.21
|
327 |
# via cffi
|
328 |
pydantic==2.5.2
|
|
|
373 |
requests==2.31.0
|
374 |
# via
|
375 |
# jupyterlab-server
|
376 |
+
# requests-oauthlib
|
377 |
# streamlit
|
378 |
+
requests-oauthlib==1.3.1
|
379 |
+
# via google-auth-oauthlib
|
380 |
rfc3339-validator==0.1.4
|
381 |
# via
|
382 |
# jsonschema
|
|
|
391 |
# via
|
392 |
# jsonschema
|
393 |
# referencing
|
394 |
+
rsa==4.9
|
395 |
+
# via google-auth
|
396 |
ruff==0.1.6
|
397 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
398 |
send2trash==1.8.2
|
|
|
401 |
# via
|
402 |
# asttokens
|
403 |
# bleach
|
404 |
+
# gspread-dataframe
|
405 |
# html5lib
|
406 |
# python-dateutil
|
407 |
# rfc3339-validator
|
|
|
414 |
# httpx
|
415 |
soupsieve==2.5
|
416 |
# via beautifulsoup4
|
417 |
+
sql-metadata==2.10.0
|
418 |
+
# via st-gsheets-connection
|
419 |
+
sqlparse==0.4.4
|
420 |
+
# via sql-metadata
|
421 |
+
st-gsheets-connection==0.0.3
|
422 |
+
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
423 |
stack-data==0.6.3
|
424 |
# via ipython
|
425 |
streamlit==1.29.0
|
426 |
# via
|
427 |
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
428 |
+
# st-gsheets-connection
|
429 |
# streamlit-oauth
|
430 |
streamlit-oauth==0.1.5
|
431 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
|
|
483 |
# pydantic
|
484 |
# pydantic-core
|
485 |
# streamlit
|
|
|
|
|
486 |
tzlocal==5.2
|
487 |
# via streamlit
|
488 |
uri-template==1.3.0
|
|
|
492 |
# requests
|
493 |
# types-requests
|
494 |
validators==0.22.0
|
495 |
+
# via
|
496 |
+
# st-gsheets-connection
|
497 |
+
# streamlit
|
498 |
watchdog==3.0.0
|
499 |
# via streamlit
|
500 |
wcwidth==0.2.12
|
pyproject.toml
CHANGED
@@ -15,6 +15,7 @@ dependencies = [
|
|
15 |
"pandas",
|
16 |
"pydantic",
|
17 |
"streamlit-oauth",
|
|
|
18 |
]
|
19 |
|
20 |
[project.optional-dependencies]
|
|
|
15 |
"pandas",
|
16 |
"pydantic",
|
17 |
"streamlit-oauth",
|
18 |
+
"st-gsheets-connection",
|
19 |
]
|
20 |
|
21 |
[project.optional-dependencies]
|
requirements.txt
CHANGED
@@ -19,7 +19,9 @@ beautifulsoup4==4.12.2
|
|
19 |
blinker==1.7.0
|
20 |
# via streamlit
|
21 |
cachetools==5.3.2
|
22 |
-
# via
|
|
|
|
|
23 |
certifi==2023.11.17
|
24 |
# via
|
25 |
# httpcore
|
@@ -29,12 +31,37 @@ charset-normalizer==3.3.2
|
|
29 |
# via requests
|
30 |
click==8.1.7
|
31 |
# via streamlit
|
|
|
|
|
32 |
duckdb==0.9.2
|
33 |
-
# via
|
|
|
|
|
34 |
gitdb==4.0.11
|
35 |
# via gitpython
|
36 |
gitpython==3.1.40
|
37 |
# via streamlit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
h11==0.14.0
|
39 |
# via httpcore
|
40 |
html5lib==1.1
|
@@ -70,20 +97,25 @@ mdurl==0.1.2
|
|
70 |
# via markdown-it-py
|
71 |
numpy==1.26.2
|
72 |
# via
|
73 |
-
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
74 |
# altair
|
|
|
75 |
# pandas
|
76 |
# pyarrow
|
77 |
# pydeck
|
78 |
# streamlit
|
|
|
|
|
79 |
packaging==23.2
|
80 |
# via
|
81 |
# altair
|
82 |
# streamlit
|
83 |
-
pandas==
|
84 |
# via
|
85 |
-
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
86 |
# altair
|
|
|
|
|
|
|
|
|
87 |
# streamlit
|
88 |
pillow==10.1.0
|
89 |
# via streamlit
|
@@ -91,6 +123,12 @@ protobuf==4.25.1
|
|
91 |
# via streamlit
|
92 |
pyarrow==14.0.1
|
93 |
# via streamlit
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
pydantic==2.5.2
|
95 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
96 |
pydantic-core==2.14.5
|
@@ -112,15 +150,22 @@ referencing==0.31.1
|
|
112 |
# jsonschema
|
113 |
# jsonschema-specifications
|
114 |
requests==2.31.0
|
115 |
-
# via
|
|
|
|
|
|
|
|
|
116 |
rich==13.7.0
|
117 |
# via streamlit
|
118 |
rpds-py==0.13.2
|
119 |
# via
|
120 |
# jsonschema
|
121 |
# referencing
|
|
|
|
|
122 |
six==1.16.0
|
123 |
# via
|
|
|
124 |
# html5lib
|
125 |
# python-dateutil
|
126 |
smmap==5.0.1
|
@@ -132,9 +177,16 @@ sniffio==1.3.0
|
|
132 |
# httpx
|
133 |
soupsieve==2.5
|
134 |
# via beautifulsoup4
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
streamlit==1.29.0
|
136 |
# via
|
137 |
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
|
|
138 |
# streamlit-oauth
|
139 |
streamlit-oauth==0.1.5
|
140 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
@@ -151,14 +203,14 @@ typing-extensions==4.8.0
|
|
151 |
# pydantic
|
152 |
# pydantic-core
|
153 |
# streamlit
|
154 |
-
tzdata==2023.3
|
155 |
-
# via pandas
|
156 |
tzlocal==5.2
|
157 |
# via streamlit
|
158 |
urllib3==2.1.0
|
159 |
# via requests
|
160 |
validators==0.22.0
|
161 |
-
# via
|
|
|
|
|
162 |
watchdog==3.0.0
|
163 |
# via streamlit
|
164 |
webencodings==0.5.1
|
|
|
19 |
blinker==1.7.0
|
20 |
# via streamlit
|
21 |
cachetools==5.3.2
|
22 |
+
# via
|
23 |
+
# google-auth
|
24 |
+
# streamlit
|
25 |
certifi==2023.11.17
|
26 |
# via
|
27 |
# httpcore
|
|
|
31 |
# via requests
|
32 |
click==8.1.7
|
33 |
# via streamlit
|
34 |
+
decorator==5.1.1
|
35 |
+
# via gspread-pandas
|
36 |
duckdb==0.9.2
|
37 |
+
# via
|
38 |
+
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
39 |
+
# st-gsheets-connection
|
40 |
gitdb==4.0.11
|
41 |
# via gitpython
|
42 |
gitpython==3.1.40
|
43 |
# via streamlit
|
44 |
+
google-auth==2.26.1
|
45 |
+
# via
|
46 |
+
# google-auth-oauthlib
|
47 |
+
# gspread
|
48 |
+
# gspread-pandas
|
49 |
+
google-auth-oauthlib==1.2.0
|
50 |
+
# via
|
51 |
+
# gspread
|
52 |
+
# gspread-pandas
|
53 |
+
gspread==5.12.4
|
54 |
+
# via
|
55 |
+
# gspread-dataframe
|
56 |
+
# gspread-formatting
|
57 |
+
# gspread-pandas
|
58 |
+
# st-gsheets-connection
|
59 |
+
gspread-dataframe==3.3.1
|
60 |
+
# via st-gsheets-connection
|
61 |
+
gspread-formatting==1.1.2
|
62 |
+
# via st-gsheets-connection
|
63 |
+
gspread-pandas==3.2.3
|
64 |
+
# via st-gsheets-connection
|
65 |
h11==0.14.0
|
66 |
# via httpcore
|
67 |
html5lib==1.1
|
|
|
97 |
# via markdown-it-py
|
98 |
numpy==1.26.2
|
99 |
# via
|
|
|
100 |
# altair
|
101 |
+
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
102 |
# pandas
|
103 |
# pyarrow
|
104 |
# pydeck
|
105 |
# streamlit
|
106 |
+
oauthlib==3.2.2
|
107 |
+
# via requests-oauthlib
|
108 |
packaging==23.2
|
109 |
# via
|
110 |
# altair
|
111 |
# streamlit
|
112 |
+
pandas==1.5.3
|
113 |
# via
|
|
|
114 |
# altair
|
115 |
+
# gspread-dataframe
|
116 |
+
# gspread-pandas
|
117 |
+
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
118 |
+
# st-gsheets-connection
|
119 |
# streamlit
|
120 |
pillow==10.1.0
|
121 |
# via streamlit
|
|
|
123 |
# via streamlit
|
124 |
pyarrow==14.0.1
|
125 |
# via streamlit
|
126 |
+
pyasn1==0.5.1
|
127 |
+
# via
|
128 |
+
# pyasn1-modules
|
129 |
+
# rsa
|
130 |
+
pyasn1-modules==0.3.0
|
131 |
+
# via google-auth
|
132 |
pydantic==2.5.2
|
133 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
134 |
pydantic-core==2.14.5
|
|
|
150 |
# jsonschema
|
151 |
# jsonschema-specifications
|
152 |
requests==2.31.0
|
153 |
+
# via
|
154 |
+
# requests-oauthlib
|
155 |
+
# streamlit
|
156 |
+
requests-oauthlib==1.3.1
|
157 |
+
# via google-auth-oauthlib
|
158 |
rich==13.7.0
|
159 |
# via streamlit
|
160 |
rpds-py==0.13.2
|
161 |
# via
|
162 |
# jsonschema
|
163 |
# referencing
|
164 |
+
rsa==4.9
|
165 |
+
# via google-auth
|
166 |
six==1.16.0
|
167 |
# via
|
168 |
+
# gspread-dataframe
|
169 |
# html5lib
|
170 |
# python-dateutil
|
171 |
smmap==5.0.1
|
|
|
177 |
# httpx
|
178 |
soupsieve==2.5
|
179 |
# via beautifulsoup4
|
180 |
+
sql-metadata==2.10.0
|
181 |
+
# via st-gsheets-connection
|
182 |
+
sqlparse==0.4.4
|
183 |
+
# via sql-metadata
|
184 |
+
st-gsheets-connection==0.0.3
|
185 |
+
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
186 |
streamlit==1.29.0
|
187 |
# via
|
188 |
# nfl-playoff-challenge-steamlit (pyproject.toml)
|
189 |
+
# st-gsheets-connection
|
190 |
# streamlit-oauth
|
191 |
streamlit-oauth==0.1.5
|
192 |
# via nfl-playoff-challenge-steamlit (pyproject.toml)
|
|
|
203 |
# pydantic
|
204 |
# pydantic-core
|
205 |
# streamlit
|
|
|
|
|
206 |
tzlocal==5.2
|
207 |
# via streamlit
|
208 |
urllib3==2.1.0
|
209 |
# via requests
|
210 |
validators==0.22.0
|
211 |
+
# via
|
212 |
+
# st-gsheets-connection
|
213 |
+
# streamlit
|
214 |
watchdog==3.0.0
|
215 |
# via streamlit
|
216 |
webencodings==0.5.1
|
src/login.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import hmac
|
2 |
+
import streamlit as st
|
3 |
+
from streamlit_gsheets import GSheetsConnection
|
4 |
+
|
5 |
+
|
6 |
+
conn = st.connection("gsheets", type=GSheetsConnection)
|
7 |
+
|
8 |
+
|
9 |
+
def get_user_id_from_email_if_exists(email: str) -> int:
|
10 |
+
# returns -1 if id not found
|
11 |
+
df_email = conn.read(
|
12 |
+
worksheet="users",
|
13 |
+
usecols=[0, 1],)
|
14 |
+
df_email = df_email[df_email.email.notna()]
|
15 |
+
for row in df_email.itertuples():
|
16 |
+
if row.email.lower() == email.lower():
|
17 |
+
return row.id
|
18 |
+
return -1
|
19 |
+
|
20 |
+
|
21 |
+
def get_password_from_user_id(user_id: int) -> str | None:
|
22 |
+
try:
|
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
|
30 |
+
|
31 |
+
|
32 |
+
def check_password():
|
33 |
+
"""Returns `True` if the user had a correct password."""
|
34 |
+
|
35 |
+
def login_form():
|
36 |
+
"""Form with widgets to collect user information"""
|
37 |
+
with st.form("Credentials"):
|
38 |
+
st.text_input("Email", key="email")
|
39 |
+
st.text_input("Password", type="password", key="password")
|
40 |
+
st.form_submit_button("Log in", on_click=password_entered)
|
41 |
+
|
42 |
+
def password_entered():
|
43 |
+
"""Checks whether a password entered by the user is correct."""
|
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,
|
51 |
+
):
|
52 |
+
st.session_state["password_correct"] = True
|
53 |
+
del st.session_state["password"] # Don't store the email or password.
|
54 |
+
del st.session_state["email"]
|
55 |
+
del password
|
56 |
+
return
|
57 |
+
st.session_state["password_correct"] = False
|
58 |
+
|
59 |
+
|
60 |
+
# Return True if the email + password is validated.
|
61 |
+
if st.session_state.get("password_correct", False):
|
62 |
+
return True
|
63 |
+
|
64 |
+
# Show inputs for email + password.
|
65 |
+
login_form()
|
66 |
+
if "password_correct" in st.session_state:
|
67 |
+
st.error("😕 User not known or password incorrect")
|
68 |
+
return False
|
src/pages/10_Set_Your_Lineup.py
CHANGED
@@ -5,6 +5,7 @@ from config import DEFAULT_ICON
|
|
5 |
from shared_page import common_page_config
|
6 |
|
7 |
from queries.nflverse.github_data import get_weekly_rosters
|
|
|
8 |
|
9 |
|
10 |
@dataclass
|
@@ -75,6 +76,8 @@ def get_page():
|
|
75 |
st.set_page_config(page_title=page_title, page_icon=DEFAULT_ICON, layout="wide")
|
76 |
common_page_config()
|
77 |
st.title(page_title)
|
|
|
|
|
78 |
|
79 |
qb_options, wr_options, rb_options, te_options, k_options, df_rosters = load_options()
|
80 |
|
|
|
5 |
from shared_page import common_page_config
|
6 |
|
7 |
from queries.nflverse.github_data import get_weekly_rosters
|
8 |
+
from login import check_password
|
9 |
|
10 |
|
11 |
@dataclass
|
|
|
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 |
|