diff --git a/passbook/core/templates/login/base.html b/passbook/core/templates/login/base.html index 27e83fa07..dcf100693 100644 --- a/passbook/core/templates/login/base.html +++ b/passbook/core/templates/login/base.html @@ -26,7 +26,7 @@
-
+
+ {% block row %}
{% block card %} @@ -47,6 +48,7 @@
+ {% endblock %}
diff --git a/passbook/core/templates/login/with_sources.html b/passbook/core/templates/login/with_sources.html new file mode 100644 index 000000000..a3435b932 --- /dev/null +++ b/passbook/core/templates/login/with_sources.html @@ -0,0 +1,51 @@ +{% extends 'login/base.html' %} + +{% load static %} +{% load i18n %} + +{% block row %} +{% include 'partials/messages.html' %} +
+
+ +
+ {% csrf_token %} + {% block above_form %} + {% endblock %} + {% include 'partials/form_login.html' %} + +
+ {% if show_sign_up_notice %} + + {% endif %} +
+
+
+
+ +
+
+ +{% endblock %} diff --git a/passbook/core/views/authentication.py b/passbook/core/views/authentication.py index 2c4332b33..b833980f8 100644 --- a/passbook/core/views/authentication.py +++ b/passbook/core/views/authentication.py @@ -13,7 +13,7 @@ from django.views.generic import FormView from passbook.core.auth.mfa import MultiFactorAuthenticator from passbook.core.forms.authentication import LoginForm, SignUpForm -from passbook.core.models import Invitation, User +from passbook.core.models import Invitation, Source, User from passbook.core.signals import invitation_used, user_signed_up from passbook.lib.config import CONFIG @@ -42,6 +42,9 @@ class LoginView(UserPassesTestMixin, FormView): kwargs['primary_action'] = _('Log in') kwargs['show_sign_up_notice'] = CONFIG.y('passbook.sign_up.enabled') kwargs['show_password_forget_notice'] = CONFIG.y('passbook.password_reset.enabled') + kwargs['sources'] = Source.objects.filter(enabled=True).select_subclasses() + if any(source.is_link for source in kwargs['sources']): + self.template_name = 'login/with_sources.html' return super().get_context_data(**kwargs) def get_user(self, uid_value) -> User: