Skip to content

Commit

Permalink
dont show auth0 if we have logged in with
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Nov 2, 2023
1 parent 3c60b96 commit 21c752b
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions src/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,31 @@ def check_password():
auth0_logged = False
password_logged = False

with col2:
try:
user_info = login_button(clientId=clientId, domain=domain,debug_logs=True)
except Exception as e:
st.text('Could not run auth')
logger.error(f'Could not run auth {e}')

if user_info is None:
st.text('No user info')

if user_info:
if '@openclimatefix.' not in user_info['email']:
st.text('This is only available to OCF members')
else:
auth0_logged = True
# check if we have logged on with a password, if we havent show auth0
if ("password_correct" not in st.session_state) or (not st.session_state["password_correct"]):
show_auth0 = True
else:
show_auth0 = False

with col2:
if show_auth0:
# show auth0 log in
try:
user_info = login_button(clientId=clientId, domain=domain,debug_logs=True)
except Exception as e:
st.text('Could not run auth')
logger.error(f'Could not run auth {e}')

if user_info is None:
st.text('No user info')

if user_info:
if '@openclimatefix.' not in user_info['email']:
st.text('This is only available to OCF members')
else:
auth0_logged = True

# if we have not logged in with auth0
if not auth0_logged:
if "password_correct" not in st.session_state:
# First run, show input for password.
Expand Down

0 comments on commit 21c752b

Please sign in to comment.