From 274c9daded3c3067d7ded1c53e26da0132248cb6 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 10 Dec 2018 13:51:50 +0100 Subject: [PATCH] core: switch to dynamic login form --- passbook/core/templates/login/base.html | 19 ++++++- passbook/core/templates/login/form.html | 30 +++------- .../core/templates/partials/form_login.html | 57 +++++++++++++++++++ 3 files changed, 84 insertions(+), 22 deletions(-) create mode 100644 passbook/core/templates/partials/form_login.html diff --git a/passbook/core/templates/login/base.html b/passbook/core/templates/login/base.html index 597434c48..b69d941e0 100644 --- a/passbook/core/templates/login/base.html +++ b/passbook/core/templates/login/base.html @@ -3,6 +3,23 @@ {% load static %} {% load i18n %} +{% block head %} + +{% endblock %} + {% block body %}
@@ -33,4 +50,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/passbook/core/templates/login/form.html b/passbook/core/templates/login/form.html index e3a224e88..e88d5c272 100644 --- a/passbook/core/templates/login/form.html +++ b/passbook/core/templates/login/form.html @@ -5,30 +5,18 @@ {% block card %}
-

{% trans 'Log In to Your Account' %}

+

{% trans title %}

{% include 'partials/messages.html' %}
{% csrf_token %} -
- - -
-
- - -
- - + {% include 'partials/form_login.html' %} +
-{% if config.sign_up.enabled %} -

{% trans 'Need an account?' %}{% trans 'Sign up' %}

+{% if show_sign_up_notice %} +

+ {% trans 'Need an account?' %} + {% trans 'Sign up' %} +

{% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/passbook/core/templates/partials/form_login.html b/passbook/core/templates/partials/form_login.html new file mode 100644 index 000000000..1129396a8 --- /dev/null +++ b/passbook/core/templates/partials/form_login.html @@ -0,0 +1,57 @@ +{% load utils %} +{% load i18n %} + +{% csrf_token %} +{% for field in form %} +
+ {% if field.field.widget|fieldtype == 'RadioSelect' %} + + {% for c in field %} +
+ + +
+ {% endfor %} + {% elif field.field.widget|fieldtype == 'Select' %} + +
+ {{ field }} +
+ {% elif field.field.widget|fieldtype == 'CheckboxInput' %} + + {% if show_password_forget_notice %} + {% trans 'Forgot password?' %} + {% endif %} + {% else %} + + {{ field|css_class:'form-control input-lg' }} + {% if field.help_text %} + + {{ field.help_text }} + + {% endif %} + {% endif %} + {% for error in field.errors %} +
+
+
+
+ +
+ + {{ error }} + +
+
+
+ {% endfor %} +
+{% endfor %}