import streamlit as st from databaseengine import DatabaseEngine #hardcodedlogin_user={ ## "passwords":["123"] #} de=DatabaseEngine() def authenticate_user(username,password): data={ "username":username, "password":password } auth=de.Login(data) #if username in hardcodedlogin_user["usernames"] and password in hardcodedlogin_user["passwords"]: if auth==True: return True else: return False def LOGIN(): with st.container(border=True): st.text("Authentication System") with st.form("login_form"): username = st.text_input("Username") password = st.text_input("Password", type="password") login_button = st.form_submit_button("Login") if login_button: if username and password: status = authenticate_user(username, password) if status==True: st.session_state.logged_in = True st.session_state.username = username st.rerun() else: st.error(message) else: st.warning("Please enter both username and password")