开发者

How can I make my django app with password reset fail gracefully when email is not configured?

If I use Django's password reset in a template like this

<li><a href="{% url django.contrib.auth.views.password_reset %}">Forgot password?</a></li>

then if I don't have an email server configured, it will still offer to send an email and won't even error when it d开发者_开发技巧oesn't.

Is there any way to make this less confusing for the user?


There is no way to display an error based upon how the Django password reset is written (check out save() in PasswordResetForm in ./django/contrib/auth/forms.py), Django is just assuming mail works.

The less confusing way would be to hide the password reset functionality entirely rather than attempt to error handle a missing email server; Django really has no way of telling whether or not the email server is correctly configured.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜