diff --git a/thirdpart/auth/forms.py b/thirdpart/auth/forms.py index 9bd4a89fe9..4f3b998ba0 100644 --- a/thirdpart/auth/forms.py +++ b/thirdpart/auth/forms.py @@ -14,7 +14,7 @@ class AuthenticationForm(forms.Form): Base class for authenticating users. Extend this to get a form that accepts username/password logins. """ - username = forms.CharField(label=_("Username"), max_length=30) + username = forms.CharField(label=_("Username"), max_length=255) password = forms.CharField(label=_("Password"), widget=forms.PasswordInput) def __init__(self, request=None, *args, **kwargs): @@ -55,7 +55,7 @@ class AuthenticationForm(forms.Form): return self.user_cache class PasswordResetForm(forms.Form): - email = forms.EmailField(label=_("E-mail"), max_length=75) + email = forms.EmailField(label=_("E-mail"), max_length=255) def clean_email(self): """ @@ -96,6 +96,7 @@ class PasswordResetForm(forms.Form): 'token': token_generator.make_token(user), 'protocol': use_https and 'https' or 'http', } + send_mail(_("Password reset on %s") % site_name, t.render(Context(c)), None, [user.username]) diff --git a/thirdpart/registration/forms.py b/thirdpart/registration/forms.py index 64dbb803ea..f923dfed9d 100644 --- a/thirdpart/registration/forms.py +++ b/thirdpart/registration/forms.py @@ -29,31 +29,14 @@ class RegistrationForm(forms.Form): registration backend. """ - username = forms.RegexField(regex=r'^\w+$', - max_length=30, - widget=forms.TextInput(attrs=attrs_dict), - label=_("Username"), - error_messages={ 'invalid': _("This value must contain only letters, numbers and underscores.") }) email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict, - maxlength=75)), + maxlength=225)), label=_("Email address")) password1 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False), label=_("Password")) password2 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False), label=_("Password (again)")) - def clean_username(self): - """ - Validate that the username is alphanumeric and is not already - in use. - - """ - try: - user = User.objects.get(username__iexact=self.cleaned_data['username']) - except User.DoesNotExist: - return self.cleaned_data['username'] - raise forms.ValidationError(_("A user with that username already exists.")) - def clean_email(self): try: user = User.objects.get(email__iexact=self.cleaned_data['email'])