Add password recovery tool
All templates overridden for easier custom texts. Login_base.html for recovery and login pages
This commit is contained in:
@@ -85,6 +85,7 @@ INSTALLED_APPS = [
|
|||||||
'django_tables2',
|
'django_tables2',
|
||||||
'auditlog',
|
'auditlog',
|
||||||
'phonenumber_field',
|
'phonenumber_field',
|
||||||
|
'password_reset',
|
||||||
]
|
]
|
||||||
|
|
||||||
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
|
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import webapp.urls
|
|||||||
import infoscreen.urls
|
import infoscreen.urls
|
||||||
import members.urls
|
import members.urls
|
||||||
import coffee_scale.urls
|
import coffee_scale.urls
|
||||||
|
import password_reset.urls
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'', include('webapp.urls')),
|
url(r'', include('webapp.urls')),
|
||||||
@@ -35,6 +36,7 @@ urlpatterns = [
|
|||||||
|
|
||||||
# admin
|
# admin
|
||||||
url(r'^admin/', admin.site.urls),
|
url(r'^admin/', admin.site.urls),
|
||||||
|
url(r'^reset/', include('password_reset.urls')),
|
||||||
|
|
||||||
# i18n default view for changing the active language
|
# i18n default view for changing the active language
|
||||||
url(r'^i18n/', include('django.conf.urls.i18n')),
|
url(r'^i18n/', include('django.conf.urls.i18n')),
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends "login_base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>SIK Admin</h1>
|
||||||
|
<form method="POST" class="form-horizontal" action=""> {% csrf_token %}
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="input-username" class="col-sm-2 col-form-label">{% trans "Username" %}</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="text" name="username" id="input-username" class="form-control" placeholder="{% trans "Username" %}"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="input-password" class="col-sm-2 col-form-label">{% trans "Password" %}</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="password" name="passwd" id="input-passwd" class="form-control" placeholder="{% trans "Password" %}"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<a href={% url "password_reset_recover" %}>Forgot password?</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<div class="text-danger">{{ error }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row" id="login-button">
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<button type="submit" class="btn btn-primary">{% trans "Log in" %}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endblock content %}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>SIK - Login</title>
|
||||||
|
<meta name="viewport" charset="utf-8" content="width=device-width" />
|
||||||
|
|
||||||
|
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
||||||
|
<script src="{% static "js/lib/jquery-3.1.0.min.js" %}"></script>
|
||||||
|
<script src="{% static "js/lib/bootstrap.min.js" %}"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="{% static "css/lib/bootstrap.min.css" %}">
|
||||||
|
<link rel="stylesheet" href="{% static "css/base.css" %}">
|
||||||
|
<link rel="stylesheet" href="{% static "css/login.css" %}">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block header %}
|
||||||
|
<div class="header">
|
||||||
|
{% include "sik_header.html" %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
<div class="page-content">
|
||||||
|
{% block content %}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
{% block footer %}
|
||||||
|
{% include "footer.html" %}
|
||||||
|
{% endblock footer %}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{% extends "login_base.html" %}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{% extends "password_reset/base.html" %}{% load i18n %}
|
||||||
|
|
||||||
|
{% block title %}{% trans "New password set" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<p>{% trans "Your password has successfully been reset. You can use it right now on the login page." %}</p>
|
||||||
|
<p><a href="/login">Log in</a></p>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{% extends "password_reset/base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block title %}{% trans "Password recovery" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form method="post" action="{{ url }}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<p><input type="submit" value="{% trans "Send" %}"></p>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{% extends "password_reset/base.html" %}{% load i18n %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% if invalid %}{% url "password_reset_recover" as recovery_url %}
|
||||||
|
<p>{% blocktrans %}Sorry, this password reset link is invalid. You can still <a href="{{ recovery_url }}">request a new one</a>.{% endblocktrans %}</p>
|
||||||
|
{% else %}
|
||||||
|
<p>{% blocktrans %}Hi, <strong>{{ username }}</strong>. Please choose your new password.{% endblocktrans %}</p>
|
||||||
|
<form method="post" action="{% url "password_reset_reset" token %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<p><input type="submit" value="{% trans "Set new password" %}"></p>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{% autoescape off %}
|
||||||
|
You're receiving this e-mail because you requested a password reset for your user account at {{ site_name }}.
|
||||||
|
|
||||||
|
Please go to the following page and choose a new password:
|
||||||
|
{% block reset_link %}
|
||||||
|
{{ protocol }}://{{ domain }}{% url django.contrib.auth.views.password_reset_confirm uidb36=uid, token=token %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
Your username, in case you've forgotten: {{ user.username }}
|
||||||
|
|
||||||
|
Thanks for using our site!
|
||||||
|
|
||||||
|
The {{ site_name }} team.
|
||||||
|
|
||||||
|
{% endautoescape %}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{% extends "password_reset/base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block title %}{% trans "Password recovery sent" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<p>{% blocktrans with ago=timestamp|timesince %}An email was sent to <strong>{{ email }}</strong> {{ ago }} ago. Use the link in it to set a new password.{% endblocktrans %}</p>
|
||||||
|
{% endblock %}
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
{% load static %}
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>SIK - Login</title>
|
|
||||||
<meta name="viewport" charset="utf-8" content="width=device-width" />
|
|
||||||
|
|
||||||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
|
||||||
<script src="{% static "js/lib/jquery-3.1.0.min.js" %}"></script>
|
|
||||||
<script src="{% static "js/lib/bootstrap.min.js" %}"></script>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="{% static "css/lib/bootstrap.min.css" %}">
|
|
||||||
<link rel="stylesheet" href="{% static "css/base.css" %}">
|
|
||||||
<link rel="stylesheet" href="{% static "css/login.css" %}">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="content-body" class="container">
|
|
||||||
<h1>SIK Admin</h1>
|
|
||||||
<form method="POST" class="form-horizontal" action=""> {% csrf_token %}
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="input-username" class="col-sm-2 col-form-label">{% trans "Username" %}</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<input type="text" name="username" id="input-username" class="form-control" placeholder="{% trans "Username" %}"></input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<label for="input-password" class="col-sm-2 col-form-label">{% trans "Password" %}</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<input type="password" name="passwd" id="input-passwd" class="form-control" placeholder="{% trans "Password" %}"></input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
|
||||||
<div class="text-danger">{{ error }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row" id="login-button">
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<button type="submit" class="btn btn-primary">{% trans "Log in" %}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Reference in New Issue
Block a user