File size: 657 Bytes
cf367e2
663a6db
cf367e2
663a6db
cf367e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import streamlit as st
import dotenv

dotenv.load_dotenv()


PASSWORD = os.getenv("APP_PASSWORD")

if "authenticated" not in st.session_state:
    st.session_state.authenticated = False

if not st.session_state.authenticated:
    password = st.text_input("Password", type="password")
    if st.button("Login"):
        if password == PASSWORD:
            st.session_state.authenticated = True
        else:
            st.error("Invalid credentials")

if st.session_state.authenticated:
    st.success("Logged in successfully!")
    # Your app content here

    st.write("Hello, world!")
else:
    st.warning("Please log in to access this app.")