mirror of https://github.com/zulip/zulip.git
social_backends: Rename display_logo to display_icon.
This commit is contained in:
parent
15126dbe31
commit
a62d084247
|
@ -82,7 +82,7 @@ it as follows:
|
|||
"Attribute Mapping" with GSuite). You'll want to connect
|
||||
these so that Zulip gets the email address (used as a unique
|
||||
user ID) and name for the user.
|
||||
5. The `display_name` and `display_logo` fields are used to
|
||||
5. The `display_name` and `display_icon` fields are used to
|
||||
display the login/registration buttons for the IdP.
|
||||
|
||||
3. Install the certificate(s) required for SAML authentication. You
|
||||
|
|
|
@ -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" {% if backend.display_logo %} style="background-image:url({{ backend.display_logo }})" {% endif %}>
|
||||
<button class="login-social-button full-width" {% if backend.display_icon %} style="background-image:url({{ backend.display_icon }})" {% endif %}>
|
||||
{{ _('Sign up with %(identity_provider)s', identity_provider=backend.display_name) }}
|
||||
</button>
|
||||
</form>
|
||||
|
|
|
@ -130,7 +130,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" {% if backend.display_logo %} style="background-image:url({{ backend.display_logo }})" {% endif %}>
|
||||
<button class="login-social-button" {% if backend.display_icon %} style="background-image:url({{ backend.display_icon }})" {% endif %}>
|
||||
{{ _('Log in with %(identity_provider)s', identity_provider=backend.display_name) }}
|
||||
</button>
|
||||
</form>
|
||||
|
|
|
@ -2173,7 +2173,7 @@ paths:
|
|||
type: array
|
||||
description: List of "social backend" objects, describing which
|
||||
social backends are enabled and their parameters - most importantly
|
||||
the login url, display_name and display_logo.
|
||||
the login url, display_name and display_icon.
|
||||
zulip_version:
|
||||
type: string
|
||||
description: The version of Zulip running in the server.
|
||||
|
@ -2239,21 +2239,21 @@ paths:
|
|||
{
|
||||
"name": "saml:idp_name",
|
||||
"display_name": "SAML",
|
||||
"display_logo": "",
|
||||
"display_icon": "",
|
||||
"login_url": "/accounts/login/social/saml/idp_name",
|
||||
"signup_url": "/accounts/register/social/saml/idp_name"
|
||||
},
|
||||
{
|
||||
"name": "google",
|
||||
"display_name": "Google",
|
||||
"display_logo": "/static/images/landing-page/logos/googl_e-icon.png",
|
||||
"display_icon": "/static/images/landing-page/logos/googl_e-icon.png",
|
||||
"login_url": "/accounts/login/social/google",
|
||||
"signup_url": "/accounts/register/social/google"
|
||||
},
|
||||
{
|
||||
"name": "github",
|
||||
"display_name": "GitHub",
|
||||
"display_logo": "/static/images/landing-page/logos/github-icon.png",
|
||||
"display_icon": "/static/images/landing-page/logos/github-icon.png",
|
||||
"login_url": "/accounts/login/social/github",
|
||||
"signup_url": "/accounts/register/social/github"
|
||||
}
|
||||
|
|
|
@ -997,7 +997,7 @@ def social_auth_finish(backend: Any,
|
|||
class SocialAuthMixin(ZulipAuthMixin):
|
||||
auth_backend_name = "undeclared"
|
||||
name = "undeclared"
|
||||
display_logo = None # type: Optional[str]
|
||||
display_icon = None # type: Optional[str]
|
||||
|
||||
# Used to determine how to order buttons on login form, backend with
|
||||
# higher sort order are displayed first.
|
||||
|
@ -1030,7 +1030,7 @@ class GitHubAuthBackend(SocialAuthMixin, GithubOAuth2):
|
|||
name = "github"
|
||||
auth_backend_name = "GitHub"
|
||||
sort_order = 100
|
||||
display_logo = "/static/images/landing-page/logos/github-icon.png"
|
||||
display_icon = "/static/images/landing-page/logos/github-icon.png"
|
||||
|
||||
def get_verified_emails(self, *args: Any, **kwargs: Any) -> List[str]:
|
||||
access_token = kwargs["response"]["access_token"]
|
||||
|
@ -1096,13 +1096,13 @@ class AzureADAuthBackend(SocialAuthMixin, AzureADOAuth2):
|
|||
sort_order = 50
|
||||
name = "azuread-oauth2"
|
||||
auth_backend_name = "AzureAD"
|
||||
display_logo = "/static/images/landing-page/logos/azuread-icon.png"
|
||||
display_icon = "/static/images/landing-page/logos/azuread-icon.png"
|
||||
|
||||
class GoogleAuthBackend(SocialAuthMixin, GoogleOAuth2):
|
||||
sort_order = 150
|
||||
auth_backend_name = "Google"
|
||||
name = "google"
|
||||
display_logo = "/static/images/landing-page/logos/googl_e-icon.png"
|
||||
display_icon = "/static/images/landing-page/logos/googl_e-icon.png"
|
||||
|
||||
def get_verified_emails(self, *args: Any, **kwargs: Any) -> List[str]:
|
||||
verified_emails = [] # type: List[str]
|
||||
|
@ -1123,7 +1123,7 @@ class SAMLAuthBackend(SocialAuthMixin, SAMLAuth):
|
|||
# SAML buttons at the top.
|
||||
sort_order = 9999
|
||||
# There's no common default logo for SAML authentication.
|
||||
display_logo = ""
|
||||
display_icon = ""
|
||||
|
||||
def auth_url(self) -> str:
|
||||
"""Get the URL to which we must redirect in order to
|
||||
|
@ -1254,17 +1254,17 @@ class SAMLAuthBackend(SocialAuthMixin, SAMLAuth):
|
|||
SocialBackendDictT = TypedDict('SocialBackendDictT', {
|
||||
'name': str,
|
||||
'display_name': str,
|
||||
'display_logo': str,
|
||||
'display_icon': str,
|
||||
'login_url': str,
|
||||
'signup_url': str,
|
||||
})
|
||||
|
||||
def create_standard_social_backend_dict(social_backend: SocialAuthMixin) -> SocialBackendDictT:
|
||||
assert social_backend.display_logo is not None
|
||||
assert social_backend.display_icon is not None
|
||||
return dict(
|
||||
name=social_backend.name,
|
||||
display_name=social_backend.auth_backend_name,
|
||||
display_logo=social_backend.display_logo,
|
||||
display_icon=social_backend.display_icon,
|
||||
login_url=reverse('login-social', args=(social_backend.name,)),
|
||||
signup_url=reverse('signup-social', args=(social_backend.name,)),
|
||||
)
|
||||
|
@ -1275,7 +1275,7 @@ def list_saml_backend_dicts(realm: Optional[Realm]=None) -> List[SocialBackendDi
|
|||
saml_dict = dict(
|
||||
name='saml:{}'.format(idp_name),
|
||||
display_name=idp_dict.get('display_name', SAMLAuthBackend.auth_backend_name),
|
||||
display_logo=idp_dict.get('display_logo', SAMLAuthBackend.display_logo),
|
||||
display_icon=idp_dict.get('display_icon', SAMLAuthBackend.display_icon),
|
||||
login_url=reverse('login-social-extra-arg', args=('saml', idp_name)),
|
||||
signup_url=reverse('signup-social-extra-arg', args=('saml', idp_name)),
|
||||
) # type: SocialBackendDictT
|
||||
|
|
|
@ -224,14 +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
|
||||
# Optionally, you can edit display_name and display_icon
|
||||
# settings below to change the name and icon that will show on
|
||||
# the login button.
|
||||
"display_name": "SAML",
|
||||
# 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": "",
|
||||
"display_icon": "",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -215,6 +215,6 @@ SOCIAL_AUTH_SAML_ENABLED_IDPS = {
|
|||
"attr_username": "email",
|
||||
"attr_email": "email",
|
||||
"display_name": "Test IdP",
|
||||
"display_logo": "/static/images/landing-page/logos/saml-icon.png",
|
||||
"display_icon": "/static/images/landing-page/logos/saml-icon.png",
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue