Merge pull request 'Разработал систему восстановления пароля' (#24) from fix_test into main
Some checks failed
Auto-update README / update-readme (push) Has been cancelled
Some checks failed
Auto-update README / update-readme (push) Has been cancelled
Reviewed-on: #24
This commit is contained in:
commit
233c377026
24
programmer/templates/password_reset_confirm.html
Normal file
24
programmer/templates/password_reset_confirm.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{% extends 'programmer/base.html' %}
|
||||||
|
{% load django_bootstrap5 %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="page-header">
|
||||||
|
<h1 class="page-title">Новый пароль</h1>
|
||||||
|
<p class="page-subtitle">Введите новый пароль для вашего аккаунта</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content-card" style="max-width: 500px; margin: 0 auto;">
|
||||||
|
{% if validlink %}
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% bootstrap_form form %}
|
||||||
|
<button type="submit" class="btn btn-primary" style="width: 100%;">Установить пароль</button>
|
||||||
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<p>Ссылка для восстановления пароля недействительна. Возможно, она уже была использована.</p>
|
||||||
|
<p>Запросите восстановление пароля <a href="{% url 'password_reset' %}">заново</a>.</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
1
programmer/templates/password_reset_subject.txt
Normal file
1
programmer/templates/password_reset_subject.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Восстановление пароля на сайте {{ site_name }}
|
||||||
@ -21,5 +21,8 @@
|
|||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
Нет аккаунта? <a href="{% url 'register' %}">Зарегистрироваться</a>
|
Нет аккаунта? <a href="{% url 'register' %}">Зарегистрироваться</a>
|
||||||
</p>
|
</p>
|
||||||
|
<p class="text-center mt-3">
|
||||||
|
<a href="{% url 'password_reset' %}">Забыли пароль?</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
21
programmer/templates/programmer/password_reset.html
Normal file
21
programmer/templates/programmer/password_reset.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{% extends 'programmer/base.html' %}
|
||||||
|
{% load django_bootstrap5 %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="page-header">
|
||||||
|
<h1 class="page-title">Восстановление пароля</h1>
|
||||||
|
<p class="page-subtitle">Введите email, указанный при регистрации</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content-card" style="max-width: 500px; margin: 0 auto;">
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% bootstrap_form form %}
|
||||||
|
<button type="submit" class="btn btn-primary" style="width: 100%;">Отправить инструкцию</button>
|
||||||
|
</form>
|
||||||
|
<hr>
|
||||||
|
<p class="text-center">
|
||||||
|
<a href="{% url 'login' %}">Вспомнили пароль? Войти</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
12
programmer/templates/programmer/password_reset_complete.html
Normal file
12
programmer/templates/programmer/password_reset_complete.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends 'programmer/base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="page-header">
|
||||||
|
<h1 class="page-title">Пароль успешно изменён</h1>
|
||||||
|
<p class="page-subtitle">Вы можете войти с новым паролем</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content-card text-center">
|
||||||
|
<a href="{% url 'login' %}" class="btn btn-primary">Войти</a>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
14
programmer/templates/programmer/password_reset_done.html
Normal file
14
programmer/templates/programmer/password_reset_done.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{% extends 'programmer/base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="page-header">
|
||||||
|
<h1 class="page-title">Письмо отправлено</h1>
|
||||||
|
<p class="page-subtitle">Проверьте вашу почту</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content-card text-center">
|
||||||
|
<p>Мы отправили вам инструкцию по восстановлению пароля на указанный email.</p>
|
||||||
|
<p>Если письмо не пришло, проверьте папку «Спам» или убедитесь, что вы ввели правильный адрес.</p>
|
||||||
|
<a href="{% url 'login' %}" class="btn btn-primary mt-3">Вернуться к входу</a>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
15
programmer/templates/programmer/password_reset_email.html
Normal file
15
programmer/templates/programmer/password_reset_email.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
{% autoescape off %}
|
||||||
|
Здравствуйте!
|
||||||
|
|
||||||
|
Вы получили это письмо, потому что запросили восстановление пароля на сайте {{ site_name }}.
|
||||||
|
|
||||||
|
Для сброса пароля перейдите по ссылке ниже:
|
||||||
|
|
||||||
|
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
|
||||||
|
|
||||||
|
Если вы не запрашивали восстановление пароля, просто проигнорируйте это письмо.
|
||||||
|
|
||||||
|
С уважением,
|
||||||
|
Команда {{ site_name }}
|
||||||
|
{% endautoescape %}
|
||||||
@ -38,6 +38,28 @@ urlpatterns = [
|
|||||||
path('profile/callbacks/', views.my_callbacks, name='my_callbacks'),
|
path('profile/callbacks/', views.my_callbacks, name='my_callbacks'),
|
||||||
path('profile/comments/', views.my_comments, name='my_comments'),
|
path('profile/comments/', views.my_comments, name='my_comments'),
|
||||||
path('profile/notifications/', views.notification_settings, name='notification_settings'),
|
path('profile/notifications/', views.notification_settings, name='notification_settings'),
|
||||||
|
path('password-reset/',
|
||||||
|
auth_views.PasswordResetView.as_view(
|
||||||
|
template_name='programmer/password_reset.html',
|
||||||
|
email_template_name='programmer/password_reset_email.html',
|
||||||
|
subject_template_name='programmer/password_reset_subject.txt'
|
||||||
|
),
|
||||||
|
name='password_reset'),
|
||||||
|
path('password-reset/done/',
|
||||||
|
auth_views.PasswordResetDoneView.as_view(
|
||||||
|
template_name='programmer/password_reset_done.html'
|
||||||
|
),
|
||||||
|
name='password_reset_done'),
|
||||||
|
path('password-reset/<uidb64>/<token>/',
|
||||||
|
auth_views.PasswordResetConfirmView.as_view(
|
||||||
|
template_name='programmer/password_reset_confirm.html'
|
||||||
|
),
|
||||||
|
name='password_reset_confirm'),
|
||||||
|
path('password-reset/complete/',
|
||||||
|
auth_views.PasswordResetCompleteView.as_view(
|
||||||
|
template_name='programmer/password_reset_complete.html'
|
||||||
|
),
|
||||||
|
name='password_reset_complete'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user