[Django]-How to set minimum number of characters for user password in django-allauth

4👍

According to django docs, you need to specify OPTIONS dict together with built in django password validator, like this:

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'OPTIONS': {
            'min_length': 5,
        },
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

0👍

ACCOUNT_PASSWORD_MIN_LENGTH is deprecated. Use Django’s own AUTH_PASSWORD_VALIDATORS setting.

👤mehmet

Leave a comment