Reputation: 11
How to add a reset password button in django-administration. And also Reset password button act like Email verificationI want like this image
Upvotes: 1
Views: 400
Reputation: 52028
As per documentation
:
the presence of the admin_password_reset named URL will cause a “forgotten your password?” link to appear on the default admin log-in page under the password box.
So, if you want to add a reset password feature in admin site login page, you need to add the following views in urls.py
:
from django.contrib.auth import views as auth_views
urlpatterns += [
path(
'admin/password_reset/',
auth_views.PasswordResetView.as_view(),
name='admin_password_reset',
), # <-- This one will make the forgot password link appear in admin site.
path(
'admin/password_reset/done/',
auth_views.PasswordResetDoneView.as_view(),
name='password_reset_done',
),
path(
'reset/<uidb64>/<token>/',
auth_views.PasswordResetConfirmView.as_view(),
name='password_reset_confirm',
),
path(
'reset/done/',
auth_views.PasswordResetCompleteView.as_view(),
name='password_reset_complete',
),
]
Upvotes: 1