Spaces:
Runtime error
Runtime error
File size: 1,079 Bytes
d934e05 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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
|