views:

265

answers:

1

How to add the forgot-password feature to Django admin site? With email/security question options? Is there any plug-in/extension available?

+5  A: 

They are all there built in the django. Just add the relevant url patterns. As follows.

from django.contrib.auth import views as auth_views

patterns+=('',
url(r'^passreset/$',auth_views.password_reset,name='forgot_password1'),
url(r'^passresetdone/$',auth_views.password_reset_done,name='forgot_password2'),
url(r'^passresetconfirm/(?P<uidb36>[-\w]+)/(?P<token>[-\w]+)/$',auth_views.password_reset_confirm,name='forgot_password3'),
url(r'^passresetcomplete/$',auth_views.password_reset_complete,name='forgot_password4'),
)

And, oh, while you are at it, also add the views and url patterns for password change.

                  url(r'^password/change/$',
                       auth_views.password_change,
                       name='auth_password_change'),
                   url(r'^password/change/done/$',
                       auth_views.password_change_done,
                       name='auth_password_change_done'),
Lakshman Prasad
+1 thanks! Does it come with emailing also?
Viet
Yea, it also emails, the relevant email ids.
Lakshman Prasad