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.
精彩评论