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.")