Skip to content

Commit

Permalink
CQA
Browse files Browse the repository at this point in the history
  • Loading branch information
scotttrinh committed Feb 20, 2024
1 parent fc34ac4 commit 40d6362
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions edb/server/protocol/auth_ext/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ def _render_oauth_buttons(
}
for p in oauth_providers
]
return '<div class="oauth-buttons">' + "\n".join(
f'<a href="../authorize?{b["authparams"]}>{b["image"]}</a>'
for b in oauth_buttons
) + '</div>'
return (
'<div class="oauth-buttons">'
+ "\n".join(
f'<a href="../authorize?{b["authparams"]}>{b["image"]}</a>'
for b in oauth_buttons
)
+ '</div>'
)


def render_login_page(
Expand Down Expand Up @@ -120,10 +124,14 @@ def render_login_page(
)

email_factor_form = f"""
<input type="hidden" name="redirect_on_failure" value="{
base_path}/ui/signin" />
<input type="hidden" name="redirect_to" value="{
redirect_to_on_signup or redirect_to}" />
<input
type="hidden"
name="redirect_on_failure"
value="{base_path}/ui/signin" />
<input
type="hidden"
name="redirect_to"
value="{redirect_to_on_signup or redirect_to}" />
<input type="hidden" name="challenge" value="{challenge}" />
<label for="email">Email</label>
Expand Down Expand Up @@ -194,23 +202,18 @@ def render_login_page(
if app_name else '<span>Sign in</span>'}</h1>
{_render_oauth_buttons(oauth_providers, oauth_params, oauth_label)}
{
"""
<div class="divider">
<span>or</span>
</div>"""
if has_email_factor is not None
and len(oauth_providers) > 0
else ''
}
{"""
<div class="divider">
<span>or</span>
</div>""" if has_email_factor and oauth_providers else ''}
{email_factor_form if has_email_factor else ''}
</form>
{forgot_link_script}
{
"""
<script type="module" src="_static/webauthn-authenticate.js"></script>"""
if webauthn_provider is not None else ''
}
{"""
<script
type="module"
src="_static/webauthn-authenticate.js"
></script>""" if webauthn_provider else ''}
''',
)

Expand Down

0 comments on commit 40d6362

Please sign in to comment.