JSenkCC commited on
Commit
bbf2bcc
·
verified ·
1 Parent(s): 8a5a9ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -28
app.py CHANGED
@@ -65,6 +65,7 @@ def main():
65
  st.success(f"Welcome back, {username}!")
66
  st.session_state.authenticated = True
67
  st.session_state.username = username
 
68
  else:
69
  st.error("Invalid username or password. Please try again.")
70
 
@@ -79,37 +80,21 @@ def main():
79
  st.success("Account created successfully! You can now log in.")
80
  else:
81
  st.error("Please fill in all fields.")
82
-
83
- # Authenticated user workspace
84
- if st.session_state.authenticated:
85
- # Display logout button in the upper-right corner
86
- with st.container():
87
- st.markdown(
88
- """
89
- <style>
90
- .logout-button {
91
- position: fixed;
92
- top: 15px;
93
- right: 15px;
94
- }
95
- </style>
96
- """,
97
- unsafe_allow_html=True,
98
- )
99
- if st.button("Log Out", key="logout"):
100
- # Show a confirmation dialog
101
- if st.button("Confirm Logout"):
102
- st.session_state.authenticated = False
103
- st.session_state.username = None
104
- st.success("You have been logged out.")
105
- st.experimental_rerun()
106
-
107
- # Workspace content
108
- st.subheader(f"Hello, {st.session_state.username}!")
109
- st.write("This is your workspace. All your saved work will appear here.")
110
 
111
  if __name__ == "__main__":
112
  main()
113
 
114
 
115
 
 
 
65
  st.success(f"Welcome back, {username}!")
66
  st.session_state.authenticated = True
67
  st.session_state.username = username
68
+ st.experimental_rerun()
69
  else:
70
  st.error("Invalid username or password. Please try again.")
71
 
 
80
  st.success("Account created successfully! You can now log in.")
81
  else:
82
  st.error("Please fill in all fields.")
83
+ else:
84
+ # Authenticated user workspace with sidebar
85
+ st.sidebar.title(f"Hello, {st.session_state.username}!")
86
+ if st.sidebar.button("Log Out"):
87
+ st.session_state.authenticated = False
88
+ st.session_state.username = None
89
+ st.experimental_rerun()
90
+
91
+ # Main content area
92
+ st.subheader(f"Welcome to your workspace, {st.session_state.username}!")
93
+ st.write("This is your personal workspace. All your saved work will appear here.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
  if __name__ == "__main__":
96
  main()
97
 
98
 
99
 
100
+