-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth_page.py
More file actions
35 lines (26 loc) · 904 Bytes
/
Copy pathauth_page.py
File metadata and controls
35 lines (26 loc) · 904 Bytes
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
import streamlit as sl
from data_fetcher import get_user_workouts, insert_user_post,get_user_sensor_data
from modules import login_box, signup_box
from datetime import datetime
import pandas as pd
from google.cloud import bigquery
def display_auth():
sl.subheader("Welcome! Please choose an option.")
col1, col2 = sl.columns(2)
if 'auth_mode' not in sl.session_state:
sl.session_state.auth_mode = 'login' # default
with col1:
if sl.button("🔐 Log In"):
sl.session_state.auth_mode = 'login'
with col2:
if sl.button("📝 Sign Up"):
sl.session_state.auth_mode = 'signup'
sl.write("---") # separator
if sl.session_state.auth_mode == 'login':
login_box()
elif sl.session_state.auth_mode == 'signup':
signup_box()
def logout():
sl.session_state.clear()
sl.query_params.clear()
sl.rerun()