Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
django - reset password template
#1
Hi,

I have the following code but for some reason on the paths don't work from the urls file!

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

urlpatterns = [

  path('login_user/', views.login_user, name="login"),
  path('logout_user/', views.logout_user, name="logout"),
  path('register_user/', views.register_user, name="register_user"),
  path('edit_profile/', UserEditView.as_view(), name="edit_profile"),
  path('password/', PasswordsChangeView.as_view(template_name='authenticate/change-password.html')),




  path('reset_password/', 
    auth_views.PasswordResetView.as_view(template_name='authenticate/password_reset.html'), 
    name="reset_password"),

  path('reset_password_sent/', 
    auth_views.PasswordResetDoneView.as_view(template_name='authenticate/password_reset_sent.html'), 
    name="password_reset_done" ),
  
  path('reset/<uidb64>/<token>/', 
    auth_views.PasswordResetConfirmView.as_view(template_name='authenticate/password_reset_form.html'), 
    name="password_reset_confirm"),  
  
  path('reset_password_complete/', 
    auth_views.PasswordResetCompleteView.as_view(template_name='authenticate/password_reset_done.html'),
    name="password_reset_complete"),

]
the below is not loading the template file:
  path('reset/<uidb64>/<token>/', 
    auth_views.PasswordResetConfirmView.as_view(template_name='authenticate/password_reset_form.html'), 
    name="password_reset_confirm"),  
instead it is bringing the one that is used by django as attached.

Attached Files

Thumbnail(s)
   
Reply
#2
I found the solution but can someone explain please:

path('reset/<uidb64>/<token>/', 
    auth_views.PasswordResetConfirmView.as_view(template_name='EmailRegs/password_reset_confirm.html'), 
    name="password_reset_confirm"),
I took off the part at the beginning of the path:
path('<uidb64>/<token>/', 
    auth_views.PasswordResetConfirmView.as_view(template_name='EmailRegs/password_reset_confirm.html'), 
    name="password_reset_confirm"),
then it works.
Reply
#3
Could be because you are using relative paths somewhere in your code?
- Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid. Albert Einstein
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] Django: encrypt user password by mean Admin site aecordoba 4 50 Apr-20-2026, 11:50 PM
Last Post: aecordoba
  Django serving wrong template at the wrong address with malformed urls.py (redactor a Drone4four 2 4,099 Aug-17-2020, 01:09 PM
Last Post: Drone4four
  Why use HTML in Django Template ift38375 2 4,301 Dec-09-2019, 02:28 AM
Last Post: snippsat
  Flask email hookup for password reset Larz60+ 0 2,937 Oct-24-2019, 01:59 AM
Last Post: Larz60+
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 6,185 Jun-30-2019, 12:21 AM
Last Post: scidam
  Django - Passing data from view for use client side with JavaScript in a template bountyhuntr 0 4,659 Jun-11-2018, 06:04 AM
Last Post: bountyhuntr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020