fix
This commit is contained in:
parent
feb58b7821
commit
2da0f315c6
2 changed files with 5 additions and 3 deletions
5
app.py
5
app.py
|
|
@ -1,8 +1,9 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
import extra_streamlit_components as stx
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
|
|
||||||
from functions import check_auth, do_logout, get_cookie_manager
|
from functions import check_auth, do_logout
|
||||||
from functions_ui import search_cas_inci, search_cir, show_login_page
|
from functions_ui import search_cas_inci, search_cir, show_login_page
|
||||||
|
|
||||||
# Configure page
|
# Configure page
|
||||||
|
|
@ -12,7 +13,7 @@ st.set_page_config(
|
||||||
layout="wide"
|
layout="wide"
|
||||||
)
|
)
|
||||||
|
|
||||||
get_cookie_manager() # deve essere renderizzato prima di check_auth
|
st.session_state["_cm"] = stx.CookieManager(key="pif_cookies") # una sola volta per rerun
|
||||||
|
|
||||||
if not check_auth():
|
if not check_auth():
|
||||||
show_login_page()
|
show_login_page()
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,8 @@ _COOKIE_MAX_AGE = 7 * 24 * 3600 # 7 giorni in secondi
|
||||||
|
|
||||||
|
|
||||||
def get_cookie_manager() -> stx.CookieManager:
|
def get_cookie_manager() -> stx.CookieManager:
|
||||||
return stx.CookieManager(key="pif_cookies")
|
"""Ritorna il CookieManager della sessione corrente (creato una volta sola per rerun in app.py)."""
|
||||||
|
return st.session_state.get("_cm")
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue