Spaces:
Sleeping
Sleeping
| # Firebase config placeholder | |
| import streamlit as st | |
| import firebase_admin | |
| from firebase_admin import credentials, auth | |
| cred = credentials.Certificate('deployment/serviceAccountKey.json') | |
| firebase_admin.initialize_app(cred) | |
| def firebase_auth_check(): | |
| st.session_state['authenticated'] = False | |
| if 'user' in st.session_state: | |
| st.session_state['authenticated'] = True | |
| return | |
| login_section = st.sidebar.expander("๐ Login / Sign-up") | |
| email = login_section.text_input("Email") | |
| password = login_section.text_input("Password", type="password") | |
| if login_section.button("Login"): | |
| try: | |
| user = auth.get_user_by_email(email) | |
| st.session_state['user'] = user | |
| st.session_state['authenticated'] = True | |
| st.success("โ Logged in successfully!") | |
| except: | |
| st.error("โ ๏ธ Invalid credentials. Try signing up.") | |