streamlit-userverwaltung/main.py

52 lines
1.1 KiB
Python

import os
import streamlit as st
import streamlit_authenticator as sauth
import numpy as np
import pandas as pd
import yaml
from yaml.loader import SafeLoader
st.set_page_config(layout='wide')
config = dict()
with open(os.getcwd()+'/config/users.yml') as file:
config = yaml.load(file, Loader=SafeLoader)
authenticator = sauth.Authenticate(
config['credentials'],
config['cookie']['name'],
config['cookie']['key'],
config['cookie']['expiry_days'],
config['pre-authorized']
)
authenticator.login()
if st.session_state["authentication_status"]:
authenticator.logout()
st.session_state['authenticator'] = authenticator
elif st.session_state["authentication_status"] is False:
st.error('Username/password is incorrect')
st.stop()
elif st.session_state["authentication_status"] is None:
st.warning('Please enter your username and password')
st.stop()
st.write('Hello')
st.button('World', use_container_width=True)
with st.sidebar:
st.button('Hallo')
st.page_link('pages/user.py')
st.page_link('pages/dashboards.py')
st.page_link('pages/dashboard.py')
st.page_link('pages/test.py')