Skip to content

Commit

Permalink
fix button
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Jun 14, 2024
1 parent 85258f3 commit 2008bd1
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions components/Auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,6 @@ def sso_buttons():
"yelp": "https://upload.wikimedia.org/wikipedia/commons/a/ad/Yelp_logo.svg",
"zendesk": "https://upload.wikimedia.org/wikipedia/commons/9/91/Zendesk_logo.svg",
}
st.markdown(
"""
<style>
.sso-button {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.sso-button img {
margin-right: 10px;
}
</style>
""",
unsafe_allow_html=True,
)
with st.form("sso_form"):
for page in os.listdir("./pages"):
if page.endswith(".py"):
Expand All @@ -129,16 +114,19 @@ def sso_buttons():
scopes = urllib.parse.quote(" ".join(scopes))
sso_uri = f"{auth_uri}?client_id={client_id_encoded}&redirect_uri={magic_link_uri_encoded}&scope={scopes}&response_type=code&access_type=offline&prompt=consent"
if sso_uri != "":
if provider in icons:
btn_label = f'<div class="sso-button"><img src="{icons[provider]}" width="24" height="24"><span>Continue with {provider.capitalize()}</span></div>'
else:
col1, col2 = st.columns([1, 5])
with col1:
if provider in icons:
icon = icons[provider]
st.image(icon, width=40)
with col2:
btn_label = f"Continue with {provider.capitalize()}"
if st.form_submit_button(btn_label, unsafe_allow_html=True):
st.markdown(
f'<meta http-equiv="refresh" content="0;URL={sso_uri}">',
unsafe_allow_html=True,
)
st.stop()
if st.form_submit_button(btn_label):
st.markdown(
f'<meta http-equiv="refresh" content="0;URL={sso_uri}">',
unsafe_allow_html=True,
)
st.stop()


def get_user():
Expand Down

0 comments on commit 2008bd1

Please sign in to comment.