Password reset option

pull/7/head
Jannis Portmann 2023-04-16 19:19:05 +02:00
parent 22d7fb2718
commit 849744e337
6 changed files with 48 additions and 2 deletions

View File

@ -0,0 +1,5 @@
{% extends 'base.html' %}
{% block content %}
<h1>Reset password</h1>
<p>New password was set successfully. Please login again.</p>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<h1>Reset password</h1>
<p>Choose a new password.</p>
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Submit" class="btn btn-pfl"/>
</form>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<h1>Reset password</h1>
<p>Enter the email of your account, you'll then recieve a reset link.</p>
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Submit" class="btn btn-pfl"/>
</form>
{% endblock %}

View File

@ -0,0 +1,10 @@
{% extends 'base.html' %}
{% block content %}
<h1>Reset password</h1>
<p>
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>
If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder.
</p>
{% endblock %}

View File

@ -4,14 +4,15 @@
<h1 class="mb-4">
User details <span class="badge bg-secondary">{{ user.username }}</span>
</h1>
<div class="alert alert-warning">Some functions do not work yet!</div>
<div class="mb-5">
<h2>Settings</h2>
<button type="button" class="btn btn-pfl">Change Password</button>
<a class="btn btn-pfl" href="{% url 'password_reset' %}">Change Password</a>
</div>
<div class="mb-3">
<h2>Delete Account</h2>
<button class="btn btn-danger">
<i class="me-1 fa-regular fa-triangle-exclamation"></i>Delete Account
<i class="me-1 fa-solid fa-triangle-exclamation"></i>Delete Account
</button>
</div>
{% endblock %}

View File

@ -19,6 +19,14 @@ urlpatterns = [
path('accounts/login/', auth_views.LoginView.as_view(template_name='registration/login.html')),
path('accounts/profile/', auth_views.LoginView.as_view(template_name='user/detail.html'), name='user_profile'),
path('accounts/register/', views.register_user, name='register_user'),
path('accounts/password_reset/', auth_views.PasswordResetView.as_view(template_name='registration/verify_email.html',
extra_context={'form_helper': settings.CRISPY_TEMPLATE_PACK}), name='password_reset'),
path('accounts/password_reset/done/',
auth_views.PasswordResetDoneView.as_view(template_name='registration/verify_email_done.html')),
path('accounts/reset/<uidb64>/<token>/',
auth_views.PasswordResetConfirmView.as_view(template_name='registration/password_reset_confirm.html', extra_context={'form_helper': settings.CRISPY_TEMPLATE_PACK})),
path('accounts/reset/<uidb64>/<token>/',
auth_views.PasswordResetCompleteView.as_view(template_name='registration/password_reset_complete.html')),
path('accounts/', include('django.contrib.auth.urls')),
path("faq/", TemplateView.as_view(template_name='app/faq.html'), name="faq"),
path("imprint/", TemplateView.as_view(template_name='app/imprint.html'), name="imprint"),