diff --git a/zproject/backends.py b/zproject/backends.py index 0a1d31ce5d..a17da60771 100644 --- a/zproject/backends.py +++ b/zproject/backends.py @@ -39,6 +39,7 @@ from decorator import decorator from django.conf import settings from django.contrib.auth import authenticate, get_backends from django.contrib.auth.backends import RemoteUserBackend +from django.contrib.staticfiles.storage import staticfiles_storage from django.core.exceptions import ValidationError from django.core.validators import validate_email from django.dispatch import Signal, receiver @@ -1851,7 +1852,7 @@ class GitHubAuthBackend(SocialAuthMixin, GithubOAuth2): name = "github" auth_backend_name = "GitHub" sort_order = 100 - display_icon = "/static/images/authentication_backends/github-icon.png" + display_icon = staticfiles_storage.url("images/authentication_backends/github-icon.png") def get_all_associated_email_objects(self, *args: Any, **kwargs: Any) -> List[Dict[str, Any]]: access_token = kwargs["response"]["access_token"] @@ -1946,7 +1947,7 @@ class AzureADAuthBackend(SocialAuthMixin, AzureADOAuth2): sort_order = 50 name = "azuread-oauth2" auth_backend_name = "AzureAD" - display_icon = "/static/images/authentication_backends/azuread-icon.png" + display_icon = staticfiles_storage.url("images/authentication_backends/azuread-icon.png") @external_auth_method @@ -1954,7 +1955,7 @@ class GitLabAuthBackend(SocialAuthMixin, GitLabOAuth2): sort_order = 75 name = "gitlab" auth_backend_name = "GitLab" - display_icon = "/static/images/authentication_backends/gitlab-icon.png" + display_icon = staticfiles_storage.url("images/authentication_backends/gitlab-icon.png") # Note: GitLab as of early 2020 supports having multiple email # addresses connected with a GitLab account, and we could access @@ -1970,7 +1971,7 @@ class GoogleAuthBackend(SocialAuthMixin, GoogleOAuth2): sort_order = 150 auth_backend_name = "Google" name = "google" - display_icon = "/static/images/authentication_backends/googl_e-icon.png" + display_icon = staticfiles_storage.url("images/authentication_backends/googl_e-icon.png") def get_verified_emails(self, *args: Any, **kwargs: Any) -> List[str]: verified_emails: List[str] = [] @@ -2001,7 +2002,7 @@ class AppleAuthBackend(SocialAuthMixin, AppleIdAuth): sort_order = 10 name = "apple" auth_backend_name = "Apple" - display_icon = "/static/images/authentication_backends/apple-icon.png" + display_icon = staticfiles_storage.url("images/authentication_backends/apple-icon.png") # Apple only sends `name` in its response the first time a user # tries to sign up, so we won't have it in consecutive attempts.