Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,17 +26,17 @@ password = os.environ['PASSWORD']
|
|
26 |
# Create a login form container
|
27 |
login_container = st.container()
|
28 |
|
29 |
-
|
30 |
-
password_input = st.text_input("Password", type="password")
|
31 |
-
st.button("authenticate", on_click=login, args=(password_input))
|
32 |
-
|
33 |
-
def login(username, password_input):
|
34 |
if password_input == password:
|
35 |
st.session_state.authenticated = True
|
36 |
login_container.empty() # Clear the login form container
|
37 |
else:
|
38 |
st.error("Invalid username or password")
|
39 |
|
|
|
|
|
|
|
|
|
40 |
# Only allow access to the app if the user is authenticated
|
41 |
if "authenticated" not in st.session_state or not st.session_state.authenticated:
|
42 |
st.stop() # Stop the app from running if the user is not authenticated
|
|
|
26 |
# Create a login form container
|
27 |
login_container = st.container()
|
28 |
|
29 |
+
def login(password_input):
|
|
|
|
|
|
|
|
|
30 |
if password_input == password:
|
31 |
st.session_state.authenticated = True
|
32 |
login_container.empty() # Clear the login form container
|
33 |
else:
|
34 |
st.error("Invalid username or password")
|
35 |
|
36 |
+
with login_container:
|
37 |
+
password_input = st.text_input("Password", type="password")
|
38 |
+
st.button("authenticate", on_click=login, args=(password_input))
|
39 |
+
|
40 |
# Only allow access to the app if the user is authenticated
|
41 |
if "authenticated" not in st.session_state or not st.session_state.authenticated:
|
42 |
st.stop() # Stop the app from running if the user is not authenticated
|