Код: Выделить всё
{% load static %}
Reset Your Password
/* Inline styles for email clients */
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333;
background-color: #f5f5f5;
margin: 0;
padding: 0;
}
.password_reset_email {
max-width: 600px;
margin: 0 auto;
padding: 2rem;
background: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.password_reset_email-header {
text-align: center;
margin-bottom: 2rem;
}
.password_reset_email-header h1 {
color: #2c3e50;
font-size: 2rem;
margin-bottom: 1rem;
}
.password_reset_email-content {
margin-bottom: 2rem;
}
.password_reset_email-content p {
margin-bottom: 1rem;
color: #333;
}
.password_reset_email-button {
display: inline-block;
background: #3498db;
color: white;
padding: 0.8rem 1.5rem;
border-radius: 4px;
text-decoration: none;
margin: 1rem 0;
}
.password_reset_email-footer {
margin-top: 2rem;
padding-top: 1rem;
border-top: 1px solid #ddd;
text-align: center;
color: #7f8c8d;
font-size: 0.9rem;
}
Reset Your Password
Hello,
We received a request to reset your password for your Test account. If you didn't make this request, you can safely ignore this email.
To reset your password, click the button below:
[url={{ protocol }}://{{ domain }}{% url ]
Reset Password
[/url]
This link will expire in 24 hours for security reasons.
If you're having trouble clicking the button, you can copy and paste this link into your browser:
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
This email was sent by Test Domain
If you have any questions, please contact our support team
Код: Выделить всё
class ResetPasswordView(SuccessMessageMixin, PasswordResetView):
template_name = 'forgot_password.html'
html_email_template_name = 'password_reset_email.html'
subject_template_name = 'Password_reset_subject.txt'
success_message = "We've emailed you instructions for resetting your password, " \
"if an account exists with the email you entered. You should receive an email shortly." \
" If you don't receive an email, " \
"please make sure you've entered the address you registered with, and check your spam folder."
success_url = reverse_lazy('login')
from django.urls import path, include
from users.views import ResetPasswordView
from django.contrib.auth import views as auth_views
urlpatterns = [
path('password_reset/', ResetPasswordView.as_view(), name='password_reset'),
path('password_reset_confirm///', auth_views.PasswordResetConfirmView.as_view(template_name='password_confirmation.html'), name='password_reset_confirm'),
path('password_reset_complete/', auth_views.PasswordResetCompleteView.as_view(template_name='password_complete.html'), name='password_reset_complete'),
]
< /code>
Что показывает электронная почта:
Пример электронной почты < /p>
Подробнее здесь: https://stackoverflow.com/questions/796 ... abbing-the