Spaces:
Sleeping
Sleeping
added passwd check again
Browse files
app.py
CHANGED
@@ -221,32 +221,32 @@ if "webpage_option" not in st.session_state:
|
|
221 |
|
222 |
PROCESS_STEPS = ["Artikel Extraktion","Artikel Finalisierung","Artikel Generierung","Artikel Ausgabe"]
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
#
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
#
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
|
251 |
col1, col2 = st.columns([2, 1])
|
252 |
|
|
|
221 |
|
222 |
PROCESS_STEPS = ["Artikel Extraktion","Artikel Finalisierung","Artikel Generierung","Artikel Ausgabe"]
|
223 |
|
224 |
+
def check_password():
|
225 |
+
"""Returns `True` if the user had the correct password."""
|
226 |
+
|
227 |
+
def password_entered():
|
228 |
+
"""Checks whether a password entered by the user is correct."""
|
229 |
+
if hmac.compare_digest(st.session_state["password"], os.environ.get("PASSWORD")):
|
230 |
+
st.session_state["password_correct"] = True
|
231 |
+
del st.session_state["password"] # Don't store the password.
|
232 |
+
else:
|
233 |
+
st.session_state["password_correct"] = False
|
234 |
+
|
235 |
+
# Return True if the password is validated.
|
236 |
+
if st.session_state.get("password_correct", False):
|
237 |
+
return True
|
238 |
+
|
239 |
+
# Show input for password.
|
240 |
+
st.text_input(
|
241 |
+
"Password", type="password", on_change=password_entered, key="password"
|
242 |
+
)
|
243 |
+
if "password_correct" in st.session_state:
|
244 |
+
st.error("π Password incorrect")
|
245 |
+
return False
|
246 |
+
|
247 |
+
|
248 |
+
if not check_password():
|
249 |
+
st.stop() # Do not continue if check_password is not True.
|
250 |
|
251 |
col1, col2 = st.columns([2, 1])
|
252 |
|