Spaces:
Runtime error
Runtime error
import streamlit as st | |
def st_setup(page_title: str, layout: str = 'wide'): | |
""" | |
Sets up standard outline (wide layout), checks for logged in status and then | |
displays the login box if not logged in. Should be used as a conditional to display | |
the other content on the page. | |
:param page_title: The streamlit page title for this page | |
:return: bool - logged in status | |
""" | |
st.set_page_config(page_title=page_title, layout=layout) | |
with st.sidebar: | |
st.image('img/uob-logo.png', width=200) | |
logged_in='logged_in' | |
if logged_in not in st.session_state or st.session_state[logged_in]==False: | |
_, c2, _ = st.columns(3) | |
with c2: | |
st.write('### Log in') | |
pw = st.text_input(type='password', label='Password') | |
if st.button('Log in'): | |
if pw == st.secrets['app_password']: | |
st.session_state[logged_in]=True | |
st.rerun() | |
else: | |
st.info("Invalid password") | |
return False | |
else: | |
return True | |