clea up code and layout
This commit is contained in:
@@ -3,8 +3,30 @@ import yaml
|
||||
from yaml.loader import SafeLoader
|
||||
import streamlit_authenticator as stauth
|
||||
from streamlit_authenticator.utilities.exceptions import LoginError
|
||||
from auth import (
|
||||
load_credentials_from_db,
|
||||
needs_password_change,
|
||||
update_password,
|
||||
get_role_for_user,
|
||||
get_fullname_for_user,
|
||||
get_sidebar
|
||||
)
|
||||
|
||||
|
||||
st.markdown("""
|
||||
<style>
|
||||
/* Streamlit Hamburger-Menü ausblenden */
|
||||
div[data-testid="stToolbar"] {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
|
||||
/* Optional: ganz entfernen statt nur unsichtbar machen */
|
||||
div[data-testid="stDecoration"] {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
from auth import load_credentials_from_db, needs_password_change, update_password
|
||||
|
||||
def get_authenticator():
|
||||
with open("config/auth.yaml", "r", encoding="utf-8") as f:
|
||||
@@ -41,8 +63,23 @@ def require_login():
|
||||
st.warning("Bitte Benutzername und Passwort eingeben.")
|
||||
st.stop()
|
||||
|
||||
# Passwortwechsel erzwingen
|
||||
#--------------------------------------------------------------------------------------
|
||||
# Ab hier bin ich eingeloggt
|
||||
#--------------------------------------------------------------------------------------
|
||||
|
||||
username = st.session_state.get("username")
|
||||
|
||||
if "df_sidebar" not in st.session_state:
|
||||
role_text = get_role_for_user(username)
|
||||
fullname = get_fullname_for_user(username)
|
||||
sidebar = get_sidebar(role_text, username)
|
||||
|
||||
st.session_state["role_text"] = role_text
|
||||
st.session_state["fullname"] = fullname
|
||||
st.session_state["df_sidebar"] = sidebar
|
||||
|
||||
# Passwortwechsel erzwingen
|
||||
|
||||
if needs_password_change(username):
|
||||
st.warning("Du musst dein Passwort ändern, bevor du die Anwendung nutzen kannst.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user