Update app.py
Browse files
app.py
CHANGED
@@ -116,15 +116,22 @@ def login_page():
|
|
116 |
else:
|
117 |
st.error("Please fill in all fields.")
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
def project_staging_page():
|
121 |
# Sidebar with logout button
|
122 |
st.sidebar.image("SimplifAI Logo Long.jpeg", use_container_width=True)
|
123 |
st.sidebar.title(f"Hello, {st.session_state.username}!")
|
124 |
if st.sidebar.button("Log Out"):
|
125 |
-
|
126 |
-
st.
|
127 |
-
st.session_state.page = "login"
|
128 |
|
129 |
# User's folder for projects
|
130 |
user_folder = os.path.join("user_projects", st.session_state.username)
|
@@ -437,9 +444,7 @@ def generate_documentation_page():
|
|
437 |
st.rerun()
|
438 |
|
439 |
if st.sidebar.button("Log Out"):
|
440 |
-
|
441 |
-
st.session_state.username = None
|
442 |
-
st.session_state.page = "login"
|
443 |
st.rerun()
|
444 |
|
445 |
st.subheader(f"Generate Documentation for {st.session_state.current_project}")
|
@@ -594,9 +599,7 @@ def saved_documentation_page():
|
|
594 |
st.session_state.page = "project_view"
|
595 |
st.rerun()
|
596 |
if st.sidebar.button("Log Out"):
|
597 |
-
|
598 |
-
st.session_state.username = None
|
599 |
-
st.session_state.page = "login"
|
600 |
st.rerun()
|
601 |
|
602 |
st.subheader(f"Saved Documentation for {st.session_state.current_project}")
|
@@ -641,9 +644,7 @@ def project_view_page():
|
|
641 |
st.session_state.page = "project_staging"
|
642 |
st.rerun()
|
643 |
if st.sidebar.button("Log Out"):
|
644 |
-
|
645 |
-
st.session_state.username = None
|
646 |
-
st.session_state.page = "login"
|
647 |
st.rerun()
|
648 |
|
649 |
# Main content for project page
|
|
|
116 |
else:
|
117 |
st.error("Please fill in all fields.")
|
118 |
|
119 |
+
def logout_user():
|
120 |
+
"""Logs out the user safely by clearing session state and navigating to the login page."""
|
121 |
+
st.session_state.authenticated = False
|
122 |
+
st.session_state.username = None
|
123 |
+
st.session_state.page = "login"
|
124 |
+
st.session_state.current_project = None # Clear project data
|
125 |
+
st.session_state.project_uploaded = False # Reset project uploaded flag
|
126 |
+
|
127 |
|
128 |
def project_staging_page():
|
129 |
# Sidebar with logout button
|
130 |
st.sidebar.image("SimplifAI Logo Long.jpeg", use_container_width=True)
|
131 |
st.sidebar.title(f"Hello, {st.session_state.username}!")
|
132 |
if st.sidebar.button("Log Out"):
|
133 |
+
logout_user()
|
134 |
+
st.rerun()
|
|
|
135 |
|
136 |
# User's folder for projects
|
137 |
user_folder = os.path.join("user_projects", st.session_state.username)
|
|
|
444 |
st.rerun()
|
445 |
|
446 |
if st.sidebar.button("Log Out"):
|
447 |
+
logout_user()
|
|
|
|
|
448 |
st.rerun()
|
449 |
|
450 |
st.subheader(f"Generate Documentation for {st.session_state.current_project}")
|
|
|
599 |
st.session_state.page = "project_view"
|
600 |
st.rerun()
|
601 |
if st.sidebar.button("Log Out"):
|
602 |
+
logout_user()
|
|
|
|
|
603 |
st.rerun()
|
604 |
|
605 |
st.subheader(f"Saved Documentation for {st.session_state.current_project}")
|
|
|
644 |
st.session_state.page = "project_staging"
|
645 |
st.rerun()
|
646 |
if st.sidebar.button("Log Out"):
|
647 |
+
logout_user()
|
|
|
|
|
648 |
st.rerun()
|
649 |
|
650 |
# Main content for project page
|