diff --git a/zerver/context_processors.py b/zerver/context_processors.py index b4a3625dfb..a7701bd305 100644 --- a/zerver/context_processors.py +++ b/zerver/context_processors.py @@ -162,6 +162,6 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]: 'signup_url': reverse('signup-social', args=(backend.name,)), 'sort_order': backend.sort_order, }) - context['social_backends'] = sorted(social_backends, key=lambda x: x['sort_order']) + context['social_backends'] = sorted(social_backends, key=lambda x: x['sort_order'], reverse=True) return context diff --git a/zproject/backends.py b/zproject/backends.py index 629a81e1e4..a7b45d2dc2 100644 --- a/zproject/backends.py +++ b/zproject/backends.py @@ -825,7 +825,8 @@ def social_auth_finish(backend: Any, class SocialAuthMixin(ZulipAuthMixin): auth_backend_name = "undeclared" - # Used to determine how to order buttons on login form + # Used to determine how to order buttons on login form, backend with + # higher sort order are displayed first. sort_order = 0 def auth_complete(self, *args: Any, **kwargs: Any) -> Optional[HttpResponse]: @@ -853,7 +854,7 @@ class SocialAuthMixin(ZulipAuthMixin): class GitHubAuthBackend(SocialAuthMixin, GithubOAuth2): auth_backend_name = "GitHub" - sort_order = 50 + sort_order = 100 def get_verified_emails(self, *args: Any, **kwargs: Any) -> List[str]: access_token = kwargs["response"]["access_token"] @@ -905,7 +906,7 @@ class GitHubAuthBackend(SocialAuthMixin, GithubOAuth2): raise AssertionError("Invalid configuration") class AzureADAuthBackend(SocialAuthMixin, AzureADOAuth2): - sort_order = 100 + sort_order = 50 auth_backend_name = "AzureAD" AUTH_BACKEND_NAME_MAP = {