diff --git a/wagtail/admin/forms.py b/wagtail/admin/forms.py index 812c4131b9..452705fdff 100644 --- a/wagtail/admin/forms.py +++ b/wagtail/admin/forms.py @@ -2,7 +2,6 @@ import copy from itertools import groupby from django import forms -from django.contrib.auth import get_user_model from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm from django.contrib.auth.models import Group, Permission from django.core import validators @@ -85,36 +84,9 @@ class LoginForm(AuthenticationForm): class PasswordResetForm(PasswordResetForm): - email = forms.EmailField(label=ugettext_lazy("Enter your email address to reset your password"), max_length=254) - - def clean(self): - cleaned_data = super().clean() - - # Find users of this email address - UserModel = get_user_model() - email = cleaned_data.get('email') - if not email: - raise forms.ValidationError(_("Please fill your email address.")) - active_users = UserModel._default_manager.filter(email__iexact=email, is_active=True) - - if active_users.exists(): - # Check if all users of the email address are LDAP users (and give an error if they are) - found_non_ldap_user = False - for user in active_users: - if user.has_usable_password(): - found_non_ldap_user = True - break - - if not found_non_ldap_user: - # All found users are LDAP users, give error message - raise forms.ValidationError( - _("Sorry, you cannot reset your password here as your user account is managed by another server.") - ) - else: - # No user accounts exist - raise forms.ValidationError(_("This email address is not recognised.")) - - return cleaned_data + email = forms.EmailField( + label=ugettext_lazy("Enter your email address to reset your password"), + max_length=254, required=True) class CopyForm(forms.Form): diff --git a/wagtail/admin/templates/wagtailadmin/account/password_reset/done.html b/wagtail/admin/templates/wagtailadmin/account/password_reset/done.html index ac8b3112ef..1b657b4b95 100644 --- a/wagtail/admin/templates/wagtailadmin/account/password_reset/done.html +++ b/wagtail/admin/templates/wagtailadmin/account/password_reset/done.html @@ -12,6 +12,6 @@ {% block furniture %}
{% trans "A link to reset your password has been emailed to you." %}
+{% trans "A link to reset your password has been emailed to you if an account exists for this address." %}