Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#34116 closed New feature (wontfix)

custom validation error in password_validators

Reported by: Mojtaba A Owned by: nobody
Component: contrib.auth Version: 4.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

i wanna have custom validation error in password_validators,
I can do this by rewriting the password validator classes and adding desired messages through options in the settings file and the password_validat section.

something like this :

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
        'OPTIONS': {
            'validation_error': 'My Custom Validation Error.',
        },
    },
    ...
]

and so on.

Apart from that I want to return custom validation error, for example in our company project we want to send our language based message without enabling t10n and l18n. Or ux writer wants to show the user the desired error according to business needs,
But it is not possible unless we directly override the password_validation classes and this is an extra and dirty work.

Is it worth the time? After spending some time, can I make a pull request?

Change History (2)

comment:1 by Mariusz Felisiak, 2 years ago

Easy pickings: unset
Resolution: invalid
Status: assignedclosed
UI/UX: unset

You can completely overwrite the list of password validators with the AUTH_PASSWORD_VALIDATORS setting. As far as I'm aware, there is no need for an extended customization in Django itself. See TicketClosingReasons/UseSupportChannels for ways to get help.

comment:2 by Mariusz Felisiak, 2 years ago

Resolution: invalidwontfix
Note: See TracTickets for help on using tickets.
Back to Top