Switch from using the admin login/logout pages to custom 'lemonauth' pages
This commit is contained in:
parent
1670b6d427
commit
c210650ca7
12 changed files with 89 additions and 3 deletions
46
lemonauth/templates/lemonauth/login.html
Normal file
46
lemonauth/templates/lemonauth/login.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
{% extends 'lemoncurry/layout.html' %}
|
||||
{% load lemonauth_tags static %}
|
||||
{% block title %}log in ~ {{ block.super }}{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" type="text/stylus" href="{% static 'lemonauth/css/login.styl' %}" />
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<div class="container">
|
||||
{% if form.errors %}
|
||||
<p class="alert alert-danger">
|
||||
<strong>Uh oh!</strong> Your username and password didn't match. Please try again.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if next %}
|
||||
{% if user.is_authenticated %}
|
||||
<p class="alert alert-warning">
|
||||
<strong>Hang on!</strong> Your account doesn't have access to this page. To proceed, please log in to an account that does have access.
|
||||
</p>
|
||||
{% else %}
|
||||
<p class="alert alert-warning">
|
||||
<strong>Oops!</strong> Please log in to see this page.
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<form class="card" method="post" action="{% url 'lemonauth:login' %}">
|
||||
<div class="card-body">
|
||||
{% form_field form.username %}
|
||||
{% form_field form.password %}
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<button class="btn btn-primary" type="submit">
|
||||
<i class="fa fa-sign-in"></i>
|
||||
log in
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
6
lemonauth/templates/lemonauth/tags/form_field.html
Normal file
6
lemonauth/templates/lemonauth/tags/form_field.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
<div class="form-group{% if field.errors %} has-error{% endif %}">
|
||||
<label for="{{ field.id_for_label }}">{{ field.label | lower }}</label>
|
||||
<input id="{{ field.id_for_label }}" class="form-control" type="{{ field.field.widget.input_type }}"
|
||||
name="{{ field.html_name }}"{% if field.value %} value="{{ field.value }}"{% endif %}{% if field.help_text %} aria-describedby="{{ field.id_for_label }}-help"{% endif %} />
|
||||
{% if field.help_text %}<p id="{{ field.id_for_label }}-help" class="form-text">{{ field.help_text }}</p>{% endif %}
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue