mirror of
https://github.com/TrentSPalmer/trentpalmerdotorg.git
synced 2024-11-21 17:11:30 -08:00
add password reset
This commit is contained in:
parent
f9f8bf13ac
commit
5d6ae12550
13
accounts/templates/accounts/password_change_done.html
Normal file
13
accounts/templates/accounts/password_change_done.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% block content %}
|
||||||
|
{% include "base_navbar.html" %}
|
||||||
|
{% include "base_heading.html" %}
|
||||||
|
|
||||||
|
<div class="d-flex flex-column align-items-center">
|
||||||
|
<p class="text-justify px-3">{% translate 'We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.' %}</p>
|
||||||
|
|
||||||
|
<p class="text-justify px-3">{% translate 'If you don’t receive an email, please make sure you’ve entered the address you registered with, and check your spam folder.' %}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
13
accounts/templates/accounts/password_reset_complete.html
Normal file
13
accounts/templates/accounts/password_reset_complete.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% include "base_navbar.html" %}
|
||||||
|
{% include "base_heading.html" %}
|
||||||
|
|
||||||
|
<p class="text-center">{% translate "Your password has been set." %}</p>
|
||||||
|
<p class="text-center">{% translate "You may go ahead and log in now." %}</p>
|
||||||
|
|
||||||
|
<p class="text-center"><a href="{{ login_url }}">{% translate 'Log in' %}</a></p>
|
||||||
|
|
||||||
|
{% endblock %}
|
14
accounts/templates/accounts/password_reset_email.html
Normal file
14
accounts/templates/accounts/password_reset_email.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{% load i18n %}{% autoescape off %}
|
||||||
|
{% blocktranslate %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktranslate %}
|
||||||
|
|
||||||
|
{% translate "Please go to the following page and choose a new password:" %}
|
||||||
|
{% block reset_link %}
|
||||||
|
{{ protocol }}://{{ domain }}{% url 'accounts:password_reset_confirm' uidb64=uid token=token %}
|
||||||
|
{% endblock %}
|
||||||
|
{% translate 'Your username, in case you’ve forgotten:' %} {{ user.get_username }}
|
||||||
|
|
||||||
|
{% translate "Thanks for using our site!" %}
|
||||||
|
|
||||||
|
{% blocktranslate %}The {{ site_name }} team{% endblocktranslate %}
|
||||||
|
|
||||||
|
{% endautoescape %}
|
40
accounts/templates/accounts/set_password_form.html
Normal file
40
accounts/templates/accounts/set_password_form.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load i18n static %}
|
||||||
|
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% include "base_navbar.html" %}
|
||||||
|
|
||||||
|
{% if validlink %}
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center my-2 mx-0">
|
||||||
|
<h1 class="text-center">Enter New Password</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="d-flex flex-column offset-sm-3 col-sm-6 col-xs-12 px-0">
|
||||||
|
<form method="POST">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form | crispy }}
|
||||||
|
<div class="mt-3">
|
||||||
|
<input type="submit" class="btn btn-dark btn-lg" value="Change My Password">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center my-2 mx-0">
|
||||||
|
<h1 class="text-center">Error</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="text-center">{% translate "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -1,4 +1,5 @@
|
|||||||
from django.urls import path
|
from django.urls import path, reverse_lazy
|
||||||
|
from django.contrib.auth import views as av
|
||||||
from .enable_totp import enable_totp, disable_totp
|
from .enable_totp import enable_totp, disable_totp
|
||||||
from .login import log_in, two_factor_input
|
from .login import log_in, two_factor_input
|
||||||
from . import views
|
from . import views
|
||||||
@ -13,4 +14,24 @@ urlpatterns = [
|
|||||||
path('enable-totp/', enable_totp, name='enable_totp'),
|
path('enable-totp/', enable_totp, name='enable_totp'),
|
||||||
path('disable-totp/', disable_totp, name='disable_totp'),
|
path('disable-totp/', disable_totp, name='disable_totp'),
|
||||||
path('two-factor-input/', two_factor_input, name='two_factor_input'),
|
path('two-factor-input/', two_factor_input, name='two_factor_input'),
|
||||||
|
|
||||||
|
path('reset-password/', av.PasswordResetView.as_view(
|
||||||
|
template_name='base_form.html',
|
||||||
|
email_template_name="accounts/password_reset_email.html",
|
||||||
|
success_url=reverse_lazy('accounts:password_reset_done')),
|
||||||
|
name='password_reset'),
|
||||||
|
|
||||||
|
path(
|
||||||
|
'reset-password-sent/',
|
||||||
|
av.PasswordResetDoneView.as_view(template_name='accounts/password_change_done.html'),
|
||||||
|
name="password_reset_done"),
|
||||||
|
|
||||||
|
path('reset/<uidb64>/<token>/', av.PasswordResetConfirmView.as_view(
|
||||||
|
template_name='accounts/set_password_form.html',
|
||||||
|
success_url=reverse_lazy('accounts:password_reset_complete')),
|
||||||
|
name="password_reset_confirm"),
|
||||||
|
|
||||||
|
path('reset-password-complete/', av.PasswordResetCompleteView.as_view(
|
||||||
|
template_name='accounts/password_reset_complete.html'),
|
||||||
|
name="password_reset_complete"),
|
||||||
]
|
]
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
{% url 'accounts:edit_profile' as edit_profile_url %}
|
{% url 'accounts:edit_profile' as edit_profile_url %}
|
||||||
{% url 'accounts:password_change' as password_change_url %}
|
{% url 'accounts:password_change' as password_change_url %}
|
||||||
{% url 'audio:new_feed' as new_feed_url %}
|
{% url 'audio:new_feed' as new_feed_url %}
|
||||||
|
{% url 'accounts:password_reset' as password_reset_url %}
|
||||||
|
|
||||||
{% if request.path == login_url %}
|
{% if request.path == login_url %}
|
||||||
{% firstof 'Login' as submit %}
|
{% firstof 'Login' as submit %}
|
||||||
@ -16,6 +17,8 @@
|
|||||||
{% firstof 'Update' as submit %}
|
{% firstof 'Update' as submit %}
|
||||||
{% elif request.path == new_feed_url %}
|
{% elif request.path == new_feed_url %}
|
||||||
{% firstof 'Submit' as submit %}
|
{% firstof 'Submit' as submit %}
|
||||||
|
{% elif request.path == password_reset_url %}
|
||||||
|
{% firstof 'Reset Password' as submit %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% include "base_navbar.html" %}
|
{% include "base_navbar.html" %}
|
||||||
@ -49,6 +52,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if request.path == login_url %}
|
||||||
|
<p>Forgot Password? <a href="{% url 'accounts:password_reset' %}">Reset Password</a></p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
{% url 'audio:new_feed' as new_feed_url %}
|
{% url 'audio:new_feed' as new_feed_url %}
|
||||||
{% url 'audio:feeds' as feeds_url %}
|
{% url 'audio:feeds' as feeds_url %}
|
||||||
{% url 'audio:home' as home_url %}
|
{% url 'audio:home' as home_url %}
|
||||||
|
{% url 'accounts:password_reset' as password_reset_url %}
|
||||||
|
{% url 'accounts:password_reset_done' as password_reset_done_url %}
|
||||||
|
{% url 'accounts:password_reset_complete' as password_reset_complete_url %}
|
||||||
|
|
||||||
{% if request.path == login_url %}
|
{% if request.path == login_url %}
|
||||||
Login?
|
Login?
|
||||||
@ -26,6 +29,12 @@
|
|||||||
Feeds
|
Feeds
|
||||||
{% elif request.path == home_url %}
|
{% elif request.path == home_url %}
|
||||||
Home
|
Home
|
||||||
|
{% elif request.path == password_reset_url %}
|
||||||
|
Reset Password?
|
||||||
|
{% elif request.path == password_reset_done_url %}
|
||||||
|
Password Reset Sent
|
||||||
|
{% elif request.path == password_reset_complete_url %}
|
||||||
|
Password Reset Complete
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ heading }}
|
{{ heading }}
|
||||||
|
Loading…
Reference in New Issue
Block a user