-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
47 lines (38 loc) · 1.31 KB
/
app.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# load the required dependencies
import streamlit as st
from time import sleep
from navigation import make_sidebar
import pickle
from pathlib import Path
import streamlit_authenticator as stauth
make_sidebar()
st.title(':violet[Welcome to BCEAD Sequencing Service Usage Tracker System]')
st.markdown('### Please log in to continue...')
names = ['shih jen', 'Chris Sham']
usernames = ['jen', 'chris']
file_path = Path(__file__).parent / 'hashed_pw.pkl'
with file_path.open('rb') as file:
hashed_passwords = pickle.load(file)
credentials = {
"usernames":{
usernames[0]:{
"name":names[0],
"password":hashed_passwords[0]
},
usernames[1]:{
"name":names[1],
"password":hashed_passwords[1]
}
}
}
authenticator = stauth.Authenticate(credentials, 'sequencing_dashboard', 'abcdef', cookie_expiry_days=0)
name, authentication_status, username = authenticator.login('main')
if authentication_status == False:
st.error('Username/password is incorrect!')
if authentication_status == None:
st.warning('Please enter your username and password')
if authentication_status:
st.session_state.logged_in = True
st.success('Logged in successfully!')
sleep(0.3)
st.switch_page('pages/Home.py')