-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthenticator.py
More file actions
24 lines (17 loc) · 773 Bytes
/
Copy pathauthenticator.py
File metadata and controls
24 lines (17 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import streamlit as st
def check_login():
#st.button("Login")
if st.session_state.username == "admin" and st.session_state.password == "admin":
st.session_state.authenticated = True
#st.experimental_rerun()
else:
st.session_state.authenticated = False
st.error("Invalid credentials")
def authenticate():
if "authenticated" not in st.session_state:
st.session_state.authenticated = False
if not st.session_state.authenticated:
st.text_input(label="Username:",value="",key="username")
st.text_input(label="Password:",type="password",value="",key="password",on_change=check_login)
# check=st.button("Login")
return st.session_state.authenticated