From 70ede8581a283fcbcb8a9a79e07249bb1b688705 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 23 Feb 2020 20:16:25 +0100 Subject: [PATCH] core: sort sources on login view --- .pylintrc | 4 ---- passbook/core/views/authentication.py | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.pylintrc b/.pylintrc index 6b975fbaf..c3044af58 100644 --- a/.pylintrc +++ b/.pylintrc @@ -7,7 +7,3 @@ const-rgx=[a-zA-Z0-9_]{1,40}$ ignored-modules=django-otp jobs=4 -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=20 diff --git a/passbook/core/views/authentication.py b/passbook/core/views/authentication.py index af9f83ef0..523cce48b 100644 --- a/passbook/core/views/authentication.py +++ b/passbook/core/views/authentication.py @@ -44,13 +44,13 @@ class LoginView(UserPassesTestMixin, FormView): kwargs["primary_action"] = _("Log in") kwargs["show_sign_up_notice"] = CONFIG.y("passbook.sign_up.enabled") kwargs["sources"] = [] - sources = Source.objects.filter(enabled=True).select_subclasses() + sources = ( + Source.objects.filter(enabled=True).order_by("name").select_subclasses() + ) for source in sources: ui_login_button = source.ui_login_button if ui_login_button: kwargs["sources"].append(ui_login_button) - # if kwargs["sources"]: - # self.template_name = "login/with_sources.html" return super().get_context_data(**kwargs) def get_user(self, uid_value) -> Optional[User]: