Updates style of password reset forms to use Bootstrap instead of Django Admin.

This commit is contained in:
Johnny 2018-10-04 18:17:32 +00:00
parent db5b68e943
commit 32c8d0fce2
5 changed files with 183 additions and 0 deletions

View file

@ -0,0 +1,31 @@
{% extends "base.html" %}
{% block titleblock %}
Forgot Password - Reset Successful
{% endblock %}
{% block body %}
{% load addclass %}
<div class="container main-content mt-4" id="main-copy">
<div class="row">
<div class="col-lg-5 offset-lg-3 col-sm-12">
<div class="card mt-3">
<div class="card-body">
<h1 class="card-title">Password Reset</h1>
<hr />
{% if user.is_authenticated %}
<div class="alert alert-info" role="alert">You are already logged in!</div>
{% else %}
<p>Your password has been successfully reset!</p>
<p>You may now log in using it <a href="{% url 'login' %}">here.</a></p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,55 @@
{% extends "base.html" %}
{% block titleblock %}
Forgot Password - Reset
{% endblock %}
{% block body %}
{% load addclass %}
<div class="container main-content mt-4" id="main-copy">
<div class="row">
<div class="col-lg-5 offset-lg-3 col-sm-12">
<div class="card mt-3">
<div class="card-body">
<h1 class="card-title">Reset Password</h1>
<hr />
{% if not validlink %}
<div class="alert alert-danger" role="alert">The password reset link has expired. Please request another to proceed.</div>
{% else %}
{% if form.errors %}
{% for field in form %}
{% for error in field.errors %}
<div class="alert alert-danger" role="alert">{{ error }}</div>
{% endfor %}
{% endfor %}
{% endif %}
<form method="post" action=".">
{% csrf_token %}
<div class="form-group">
<label for="id_username">Enter new password:</label>
{{ form.new_password1 | addclass:"form-control" }}
</div>
<div class="form-group">
<label for="id_username">Confirm password:</label>
{{ form.new_password2 | addclass:"form-control" }}
</div>
<hr />
<div class="form-group">
<input class="form-control btn btn-outline-secondary" type="submit" value="Login" />
<input type="hidden" name="next" value="{{ next }}" />
</div>
</form>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,34 @@
{% extends "base.html" %}
{% block titleblock %}
Forgot Password - Reset Link Sent
{% endblock %}
{% block body %}
{% load addclass %}
<div class="container main-content mt-4" id="main-copy">
<div class="row">
<div class="col-lg-5 offset-lg-3 col-sm-12">
<div class="card mt-3">
<div class="card-body">
<h1 class="card-title">Reset Sent</h1>
<hr />
{% if user.is_authenticated %}
<div class="alert alert-info" role="alert">You are already logged in!</div>
{% else %}
<p>Instructions for resetting your password will be emailed to the
address you provided, if that address matches the one we have on file
for your account. You should receive them shortly.</p>
<p>Please allow up to to a few hours for the email to transmit, and be
sure to check your spam folder if it doesn't show up in a timely manner.</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,15 @@
{% autoescape off %}
To initiate the password reset process for your {{ user.get_username }} {{ site_name }} account,
click the link below:
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
If clicking the link above doesn't work, please copy and paste the URL in a new browser
window instead.
If you did not request a password reset, please disregard this notice. Whoever requested it
cannot follow through on resetting your password without access to this message.
Sincerely,
{{ site_name }} Management.
{% endautoescape %}

View file

@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block titleblock %}
Forgot Password
{% endblock %}
{% block body %}
{% load addclass %}
<div class="container main-content mt-4" id="main-copy">
<div class="row">
<div class="col-lg-5 offset-lg-3 col-sm-12">
<div class="card mt-3">
<div class="card-body">
<h1 class="card-title">Forgot Password</h1>
<hr />
{% if user.is_authenticated %}
<div class="alert alert-info" role="alert">You are already logged in!</div>
{% else %}
{% if form.errors %}
<div class="alert alert-danger" role="alert">The email address provided is incorrect.</div>
{% endif %}
{% endif %}
{% if not user.is_authenticated %}
<form method="post" action=".">
{% csrf_token %}
<div class="form-group">
<label for="id_username">Email address:</label>
{{ form.email | addclass:"form-control" }}
<small id="emailHelp" class="form-text text-muted">The email address you provided at registration. If you left it blank, your password cannot be reset through this form.</small>
</div>
<hr />
<div class="form-group">
<input class="form-control btn btn-outline-secondary" type="submit" value="Login" />
<input type="hidden" name="next" value="{{ next }}" />
</div>
</form>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}