import streamlit as st
from firestore_utils import *
import os
from AdminPages import *
st.set_page_config(page_title="Placement Tracker",
layout="centered", # or "centered"
initial_sidebar_state="expanded")
if not st.experimental_user.is_logged_in:
if st.button("login"):
st.login("microsoft")
if st.experimental_user.is_logged_in:
user = st.experimental_user
st.session_state["user"] = user
email = user.email
create_user_role(email)
role = get_user_role(user.email)
# Define role-based pages
if role == "admin":
pages = st.navigation(
[
st.Page("AdminPages/CreateJob.py", title="Create your account"),
]
)
pages.run()
with st.sidebar:
st.write('you are an admin')
I am trying to create a role based login system, storing the user in firestore and assigning the role value as “admin” or “user”, however when I try to create a multiple page website it does not work, it only shows the ‘you are admin’ text (last line) in the side bar and the navigation does not work.
I have created multi page webapps before using the session state but I faced issues like the user gets logged out when the page is refreshed and since I have to create role and store them (rest of the user interaction with the website will depend on that) I am using firestore.