Open gavinwahl opened 9 years ago
Also, there is some help_text:
https://github.com/django/django/blob/master/django/contrib/auth/forms.py#L272
When trying to use authtools with Django 1.9 I get the following error:
django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:
ERRORS:
<class 'files.admin.UserAdmin'>: (admin.E108) The value of 'list_display[2]' refers to 'name', which is not a callable, an attribute of 'UserAdmin', or an attribute or method on 'auth.User'.
Is this ticket related to that error?
I don't think that's related. Can you open another issue with the value of AUTH_USER_MODEL and files.admin.UserAdmin?
At first glance, the mechanism without the help text, seems like it will work modifying the clean_password2
in forms.py
:
Django method vs authtools method
At second glance, care should be taken for the USERNAME_FIELD
which is different in EmailUser and NameUser classes. Except if self.cleaned_data.get('username')
automatically fetches the relevant field.
I will give it a try, when I am not at work...
I am currently using this solution, which should be easy to adapt for authtools
from authtools.forms import UserCreationForm
from django.contrib.auth.password_validation import validate_password
class SignupForm(UserCreationForm):
class Meta:
model = User
fields = [
'name',
'email',
'password1',
'password2'
]
def clean_password1(self):
validate_password(self.cleaned_data.get('password1'))
Same problem on Django 1.10.6
It needs to call django.contrib.auth.password_validation.validate_password to hook in to https://docs.djangoproject.com/en/dev/topics/auth/passwords/#enabling-password-validation