Reputation: 100
I need to get rid of the password constraints in the default django password register system so that a user doesn't need to have the password be eight characters or the password can't be too similar to the username, and be able to add my own password constraints such as a strength detector.
Upvotes: 2
Views: 1389
Reputation: 32294
The setting AUTH_PASSWORD_VALIDATORS is a list of validators/constraints that a user's password must pass. If you use startproject
these will be set to include both constraints you mention. You can remove them from the setting
For example, this is what the setting looks like from a fresh project started using startproject
using the latest version of Django
AUTH_PASSWORD_VALIDATORS = [
{ # This validates against the username
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{ # This validates the length
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
Upvotes: 3