I really admire your work…
I’m trying to reset the password for those who forgot their password.
When I press the submit button to change the password, instead of being redirected to success url auth/profile/,
the redirect does this crazy path: /accounts/login/?next=/auth/profile/
“GET /accounts/login/?next=/auth/profile/ HTTP/1.1” 404 2595
#accounts.views
class CustomPasswordResetConfirmView(PasswordResetConfirmView):
template_name = 'custom_password_reset_confirm.html'
success_url = reverse_lazy('profile')
def form_valid(self, form):
messages.success(self.request, 'Password Changed.')
return super().form_valid(form)
#accounts.urls
urlpatterns = [
...
path('reset-password/', PasswordResetView.as_view(), name='password_reset'),
path('reset-password/confirm/<uidb64>/<token>/', CustomPasswordResetConfirmView.as_view(), name='password_reset_confirm'),
...
path('profile/', profile, name='profile'),
]
#mainapp
urlpatterns = [
path('admin/', admin.site.urls,name='admin'),
path('', HomeListView.as_view(), name='home'),
path('auth/', include('accounts.urls')),
path('home/', include('home.urls')),
]
The strangest thing is that shortly after, I am automatically logged out, but the password is changed, which means that the email that sends the encrypted user is working.