1
crosspost from: https://feddit.org/post/26317173
Hi,
I build my own UserModel with email instead of username and now the PasswordResetConfirmView does not render the form for setting a new password. Form is None and Title "Password reset unsuccessful". All other forms are working correct.
I am using the standard "django.contrib.auth".
My user-class:
class MyUser(AbstractUser): username=None email=models.EmailField(_('email address'),unique=True) USERNAME_FIELD='email' REQUIRED_FIELDS=[]My
urls.pyfrom django.urls import path, include from django.contrib.auth import views as auth_views urlpatterns = [ path('password_reset/', auth_views.PasswordResetView.as_view(template_name='password_reset.html', html_email_template_name='password_reset_email.html'), name='password_reset'), path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(template_name='password_reset_done.html'), name='password_reset_done'), path('password_reset/confirm/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(template_name='password_reset_confirm.html'),name='password_reset_confirm'), path('password_reset/complete/', auth_views.PasswordResetCompleteView.as_view(template_name='password_reset_complete.html'),name='password_reset_complete'), ]The reset link in console looks a bit wired:
Please go to the following page and choose a new password: http://127.0.0.1:8000/accounts/password_reset/confirm/Mg/d4khhw-79d3d64161aaf= 78fe9f0542f1883e48c/Also, there is no redirect to:
http://127.0.0.1:8000/accounts/password_reset/confirm/Mg/set-password/I tried clicking the link, copying it. Nothing works. What am I missing here. Some tips would be appreciated.