eagle0504 commited on
Commit
32019ff
·
verified ·
1 Parent(s): 4403c65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -9
app.py CHANGED
@@ -34,15 +34,21 @@ with st.sidebar:
34
 
35
  # Login
36
  with st.expander("Login 🔒", expanded=True):
37
- authenticator.logout("Logout", "main", key="unique_key")
 
38
  if st.session_state["authentication_status"]:
39
- authenticator.logout("Logout")
 
 
 
40
  st.write(f'Welcome *{st.session_state["name"]}*')
41
- st.title('Welcome!')
 
 
42
  elif st.session_state["authentication_status"] is False:
43
- st.error('Username/password is incorrect')
44
  elif st.session_state["authentication_status"] is None:
45
- st.warning('Please enter your username and password')
46
 
47
  # Reset Password
48
  with st.expander("Reset password 😕"):
@@ -109,15 +115,21 @@ if st.session_state["authentication_status"]:
109
 
110
  # Log out
111
  with st.sidebar:
112
- with st.expander("Logout 🔒", expanded=True):
 
 
113
  if st.session_state["authentication_status"]:
114
- authenticator.logout("Logout", "main", key="unique_key")
 
 
 
 
115
  st.title(
116
- "You logged in! You can start a conversation in the textbox."
117
  )
118
  st.markdown(
119
  "### 🖱️Press "
120
- R" on your keyboard⌨️ to rerun the app if needed 🔄."
121
  )
122
  elif st.session_state["authentication_status"] is False:
123
  st.error("Username/password is incorrect")
 
34
 
35
  # Login
36
  with st.expander("Login 🔒", expanded=True):
37
+ authenticator.login("Login", "main")
38
+
39
  if st.session_state["authentication_status"]:
40
+ try:
41
+ authenticator.logout("Logout", "main", key="unique_key")
42
+ except:
43
+ pass
44
  st.write(f'Welcome *{st.session_state["name"]}*')
45
+ st.title(
46
+ "You logged in! You can choose a session in the bottom of the sidebar and view content."
47
+ )
48
  elif st.session_state["authentication_status"] is False:
49
+ st.error("Username/password is incorrect")
50
  elif st.session_state["authentication_status"] is None:
51
+ st.warning("Please enter your username and password")
52
 
53
  # Reset Password
54
  with st.expander("Reset password 😕"):
 
115
 
116
  # Log out
117
  with st.sidebar:
118
+ with st.expander("Login 🔒", expanded=True):
119
+ authenticator.login("Login", "main")
120
+
121
  if st.session_state["authentication_status"]:
122
+ try:
123
+ authenticator.logout("Logout", "main", key="unique_key")
124
+ except KeyError as e:
125
+ st.warning(f"Logout failed: {str(e)}")
126
+ st.write(f'Welcome *{st.session_state["name"]}*')
127
  st.title(
128
+ "You logged in! You can choose a session in the bottom of the sidebar and view content."
129
  )
130
  st.markdown(
131
  "### 🖱️Press "
132
+ R" on your keyboard⌨️ to rerun the app for faster loading 🔄."
133
  )
134
  elif st.session_state["authentication_status"] is False:
135
  st.error("Username/password is incorrect")