Пример ошибки домена в django при сбросе пароля
Я пишу программу для сброса пароля на django. После заполнения email id и отправки ссылки для изменения пароля, когда я нажимаю на ссылку, она переходит на страницу домена example.Почему это происходит.
setting.py
INSTALLED_APPS = ['django.contrib.auth',]
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '*****@gmail.com'
EMAIL_HOST_PASSWORD = '****'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'TestSite Team <noreply@example.com>'
urls.py
from django.contrib.auth.views import LoginView,LogoutView,PasswordResetView,PasswordResetDoneView,PasswordResetConfirmView,PasswordResetCompleteView
url(r'^password_reset/$',PasswordResetView.as_view(), name='password_reset'),
url(r'^password_reset/done/$',PasswordResetDoneView.as_view(), name='password_reset_done'),
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
url(r'^reset/done/$',PasswordResetCompleteView.as_view(), name='password_reset_complete'),
restPass.html
{% extends 'base.html' %}
{% block body %}
<h3>Forgot password</h3>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Submit</button>
</form>
{% endblock %}
resEmail.html
{% extends 'base.html' %}
{% block body %}
{% autoescape off %}
To initiate the password reset process for your {{ user.get_username }} TestSite Account,
click the link below:
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
If clicking the link above doesn't work, please copy and paste the URL in a new browser
window instead.
Sincerely,
The TestSite Team
{% endautoescape %}
{%endblock%}
resPassDone.html
{% extends 'base.html' %}
{% block body %}
<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%}
resPassConfirm.html
{% extends 'base.html' %}
{% block body %}
{% if validlink %}
<h3>Change password</h3>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Change password</button>
</form>
{% else %}
<p>
The password reset link was invalid, possibly because it has already been used.
Please request a new password reset.
</p>
{%endblock%}
введите описание изображения здесь