Spaces:
Build error
Build error
Shafeek Saleem
commited on
Commit
·
9e53e29
1
Parent(s):
b20b93b
initjj
Browse files- utils/login.py +11 -13
utils/login.py
CHANGED
|
@@ -14,19 +14,17 @@ def initialize_login():
|
|
| 14 |
password = st.text_input("Password", type="password")
|
| 15 |
|
| 16 |
if st.button("Login"):
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
st.success("Login Successful!")
|
| 29 |
-
st.experimental_rerun()
|
| 30 |
else:
|
| 31 |
st.sidebar.success(f'Hello, {st.session_state["login"]["Name"]}!')
|
| 32 |
|
|
|
|
| 14 |
password = st.text_input("Password", type="password")
|
| 15 |
|
| 16 |
if st.button("Login"):
|
| 17 |
+
authorized = authenticate(username, password)
|
| 18 |
+
if authorized["status"]:
|
| 19 |
+
st.session_state["login"] = authorized
|
| 20 |
+
os.makedirs(
|
| 21 |
+
os.path.join(".sessions", st.session_state["login"]["username"]),
|
| 22 |
+
exist_ok=True,
|
| 23 |
+
)
|
| 24 |
+
st.success("Login Successful!")
|
| 25 |
+
st.experimental_rerun()
|
| 26 |
+
else:
|
| 27 |
+
st.error("Invalid username or password")
|
|
|
|
|
|
|
| 28 |
else:
|
| 29 |
st.sidebar.success(f'Hello, {st.session_state["login"]["Name"]}!')
|
| 30 |
|