core: switch to dynamic login form

This commit is contained in:
Jens Langhammer 2018-12-10 13:51:50 +01:00
parent 2a500b3e4a
commit 274c9daded
3 changed files with 84 additions and 22 deletions

View File

@ -3,6 +3,23 @@
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
{% block head %}
<style>
.login-pf-page .login-pf-page-footer-links {
padding: 15px;
background-color: #fff;
}
.login-pf-page .login-pf-page-footer-link {
color: #72767b;
}
.login-pf-page .login-pf-page-footer-links li:not(:last-of-type):after {
color: #72767b;
}
</style>
{% endblock %}
{% block body %} {% block body %}
<div class="login-pf-page"> <div class="login-pf-page">
<div class="container-fluid"> <div class="container-fluid">

View File

@ -5,30 +5,18 @@
{% block card %} {% block card %}
<header class="login-pf-header"> <header class="login-pf-header">
<h1>{% trans 'Log In to Your Account' %}</h1> <h1>{% trans title %}</h1>
</header> </header>
{% include 'partials/messages.html' %} {% include 'partials/messages.html' %}
<form method="POST"> <form method="POST">
{% csrf_token %} {% csrf_token %}
<div class="form-group"> {% include 'partials/form_login.html' %}
<label class="sr-only" for="uid_field">{% trans 'UID' %}</label> <button type="submit" class="btn btn-primary btn-block btn-lg">{% trans primary_action %}</button>
<input type="text" class="form-control input-lg" name="uid_field" placeholder="UID">
</div>
<div class="form-group">
<label class="sr-only" for="password">{% trans 'Password' %}</label>
<input type="password" class="form-control input-lg" name="password" placeholder="Password">
</div>
<div class="form-group login-pf-settings">
<label class="checkbox-label">
<input name="remember_me" type="checkbox"> {% trans 'Keep me logged in for 30 days' %}
</label>
{% if config.password_reset.enabled %}
<a href="#">{% trans 'Forgot password?' %}</a>
{% endif %}
</div>
<button type="submit" class="btn btn-primary btn-block btn-lg">Log In</button>
</form> </form>
{% if config.sign_up.enabled %} {% if show_sign_up_notice %}
<p class="login-pf-signup">{% trans 'Need an account?' %}<a href="#">{% trans 'Sign up' %}</a></p> <p class="login-pf-signup">
{% trans 'Need an account?' %}
<a href="{% url 'passbook_core:auth-sign-up' %}">{% trans 'Sign up' %}</a>
</p>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -0,0 +1,57 @@
{% load utils %}
{% load i18n %}
{% csrf_token %}
{% for field in form %}
<div class="form-group login-pf-settings">
{% if field.field.widget|fieldtype == 'RadioSelect' %}
<label class="col-sm-2 control-label" {% if field.field.required %}class="required"{% endif %} for="{{ field.name }}-{{ forloop.counter0 }}">
{{ field.label }}
</label>
{% for c in field %}
<div class="radio col-sm-10">
<input type="radio" id="{{ field.name }}-{{ forloop.counter0 }}" name="{% if wizard %}{{ wizard.steps.current }}-{% endif %}{{ field.name }}" value="{{ c.data.value }}" {% if c.data.selected %} checked {% endif %}>
<label class="col-sm-2 control-label" for="{{ field.name }}-{{ forloop.counter0 }}">{{ c.choice_label }}</label>
</div>
{% endfor %}
{% elif field.field.widget|fieldtype == 'Select' %}
<label class="col-sm-2 control-label" {% if field.field.required %}class="required"{% endif %} for="{{ field.name }}-{{ forloop.counter0 }}">
{{ field.label }}
</label>
<div class="select col-sm-10">
{{ field }}
</div>
{% elif field.field.widget|fieldtype == 'CheckboxInput' %}
<label class="checkbox-label">
{{ field }} {{ field.label }}
</label>
{% if show_password_forget_notice %}
<a href="#">{% trans 'Forgot password?' %}</a>
{% endif %}
{% else %}
<label class="col-sm-2 sr-only" {% if field.field.required %}class="required"{% endif %} for="{{ field.name }}-{{ forloop.counter0 }}">
{{ field.label }}
</label>
{{ field|css_class:'form-control input-lg' }}
{% if field.help_text %}
<span>
{{ field.help_text }}
</span>
{% endif %}
{% endif %}
{% for error in field.errors %}
<div class="alert alert-danger">
<div class="alert-items">
<div class="alert-item">
<div class="alert-icon-wrapper">
<clr-icon class="alert-icon" shape="exclamation-circle"></clr-icon>
</div>
<span class="alert-text">
{{ error }}
</span>
</div>
</div>
</div>
{% endfor %}
</div>
{% endfor %}