标签云

微信群

扫码加入我们

WeChat QR Code

I'm using Django's built in reset password views with custom templates. Although it works successfully, it does not show an error message if the email id submitted is not already registered in the site.I followed the instructions here to help me reach till this point.#urls.pyurl(r'^users/password/reset/$','django.contrib.auth.views.password_reset',{'post_reset_redirect' : '/users/password/reset/done/'}, name="reset_password"),url(r'^users/password/reset/done/$', 'django.contrib.auth.views.password_reset_done'),url(r'^users/password/reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm',{'post_reset_redirect' : '/users/password/done/'}),url(r'^users/password/done/$', 'django.contrib.auth.views.password_reset_complete'),Whatever email id I give, Django always redirects me to /users/password/reset/done/ which says:We've e-mailed you instructions for setting your password to the e-mail addressyou submitted.You should be receiving it shortly.This is misleading, since users might've entered their email address wrong and still be seeing the above page.How do I show an error message if the email address is not registered?Thanks in advance.


Oh.. I am already using django-allauth for Facebook login. I didn't know they also provided reset password functionality. How do I wire the urls to use django-allauth? They don't have very good documentation. Thanks a ton for your help :)

2019年08月26日37分54秒

try accessing localhost:8000/accounts/password/reset (for localhost)

2019年08月26日37分54秒

To change the template just override whatever you need in your templates/account/ directory (in this case the ones related to password resets): github.com/pennersr/django-allauth/tree/master/allauth/…

2019年08月26日37分54秒

Thank you so much. Answer accepted :)

2019年08月26日37分54秒

Make sure you use allauth for login, register, etc...makes more sense to have only one app for everything and allauth is pretty good for doing the basic user handling

2019年08月26日37分54秒