2

I create login page. My problem is with "forgotten password". User enter a mail and django send a message with link. When click on it must change password. When complet click on "Change password" we should move on next page but it is blank. But password was changed.

account/urls.py

from django.urls import path, reverse_lazy
from django.contrib.auth import views as auth_views
from . import views

app_name = 'account'

urlpatterns = [
    path('', auth_views.LoginView.as_view(template_name='account/login.html'), name='login'),
    path('logout/', auth_views.LogoutView.
         as_view(template_name='registration/logout.html'), name='logout'),
    path('logout_then_login/', auth_views.logout_then_login, name='logout_then_login'),
    path('dashboard/', views.dashboard, name='dashboard'),
    path('password_change/', auth_views.PasswordChangeView.
         as_view(success_url=reverse_lazy('account:password_change_done')), name='password_change'),
    path('password_change_done/', auth_views.PasswordChangeDoneView.
         as_view(template_name='registration/password_change_done.html'),
         name='password_change_done'),
    path('password_reset/', auth_views.PasswordResetView.
         as_view(template_name='registration/password_reset_form.html',
                 html_email_template_name='registration/password_reset_mail.html'),
         name='password_reset'),
    path('password_reset/done', auth_views.PasswordResetDoneView.
         as_view(template_name='registration/password_reset_done.html'),
         name='password_reset_done'),
    path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.
         as_view(template_name='registration/password_reset_confirm.html'),
         name='password_reset_confirm'),
    path('reset/done', auth_views.PasswordResetCompleteView.
         as_view(template_name='registration/password_reset_complete.html'),
         name='password_reset_complete')
]

password_reset_complete.html

{% extends "base.html" %}

{% block title %}
    <p>Password was changed</p>
{% endblock %}

settings.py

LOGIN_REDIRECT_URL = reverse_lazy('account:dashboard')
LOGIN_URL = reverse_lazy('account:login')
SUCCESS_URL = reverse_lazy('account:password_change_done')

and is it correct:

urls.py

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('account.urls')),
    path('', include('django.contrib.auth.urls')),
]
Martix
  • 143
  • 1
  • 6
  • Is this `title` block by any chance in the head and just sets the title of the tab? Maybe you have to show the base template. – user2390182 Dec 14 '18 at 11:07
  • I found. Changed password_reset_complete.html - it was without {% block content % }{% endblock %} – Martix Dec 14 '18 at 11:18

1 Answers1

1

I'm assuming base.html contains a content block. So you are simply missing the

{% block content %}{% endblock %}

part of password_reset_complete.html.

Gjert
  • 1,069
  • 1
  • 18
  • 48