auth: Support not using an icon when rendering social login buttons.

Since we were using a placeholder emote for SAML, we change the
defaults to no icon now that it's possible.
This commit is contained in:
Mateusz Mandera
2019-10-26 02:03:06 +02:00
committed by Tim Abbott
parent b870816a75
commit 9d14b50186
4 changed files with 11 additions and 6 deletions

View File

@@ -77,7 +77,7 @@ page can be easily identified in it's respective JavaScript file -->
<div class="login-social">
<form class="form-inline" action="{{ backend.signup_url }}" method="get">
<input type='hidden' name='multiuse_object_key' value='{{ multiuse_object_key }}' />
<button class="login-social-button full-width" style="background-image:url({{ backend.display_logo }})">
<button class="login-social-button full-width" {% if backend.display_logo %} style="background-image:url({{ backend.display_logo }})" {% endif %}>
{{ _('Sign up with %(identity_provider)s', identity_provider=backend.display_name) }}
</button>
</form>

View File

@@ -134,7 +134,7 @@ page can be easily identified in it's respective JavaScript file. -->
<div class="login-social">
<form class="social_login_form form-inline" action="{{ backend.login_url }}" method="get">
<input type="hidden" name="next" value="{{ next }}">
<button class="login-social-button" style="background-image:url({{ backend.display_logo }})">
<button class="login-social-button" {% if backend.display_logo %} style="background-image:url({{ backend.display_logo }})" {% endif %}>
{{ _('Log in with %(identity_provider)s', identity_provider=backend.display_name) }}
</button>
</form>

View File

@@ -1122,7 +1122,8 @@ class SAMLAuthBackend(SocialAuthMixin, SAMLAuth):
# to have it as their main authentication method, so it seems appropriate to have
# SAML buttons at the top.
sort_order = 9999
display_logo = "/static/images/landing-page/logos/saml-icon.png"
# There's no common default logo for SAML authentication.
display_logo = ""
def auth_url(self) -> str:
"""Get the URL to which we must redirect in order to

View File

@@ -224,10 +224,14 @@ SOCIAL_AUTH_SAML_ENABLED_IDPS = {
# The "x509cert" attribute is automatically read from
# /etc/zulip/saml/idps/{idp_name}.crt; don't specify it here.
# Optionally, you can edit display_name and display_logo settings below
# to change the name and icon that will show on the login button.
# Optionally, you can edit display_name and display_logo
# settings below to change the name and icon that will show on
# the login button.
"display_name": "SAML",
"display_logo": "/static/images/landing-page/logos/saml-icon.png"
# Path to a square image file containing a logo to appear at
# the left end of the login/register buttons for this IDP.
# The default of "" results in a text-only button.
"display_logo": "",
}
}