Changing password_validation.MinimumLengthValidator value

Hello everyone,

I guess it should be easy but I can’t find how to change django.contrib.auth.password_validation.MinimumLengthValidator value, to go from 8 to 14 or more.

I tried editing the config.yml file inside the mayan_app container, but I think my syntax wasn’t proper because nothing I do has any effect (using the docker compose install, I do a docker compose restart after every change). I tried adding the value in the django settings inside Mayan (in the AUTH_PASSWORD_VALIDATORS section), but I can’t get it to work.

Any help ?
Thank you.

Hi,

Because the Django’s AUTH_PASSWORD_VALIDATORS setting is a list you will need to include all validators even if you just want to change a single one.

You can change it from the user interface. That will be saved in the config.yaml file in the volume and is persistent.

You can also pass the setting as an environment variable by adding the prefix MAYAN_ in the .env file. This is more involved because you are passing a dictionary inside a text variable and requires additional escaping, but it allows for automation.

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

To check quickly if the setting was recognized after a restart you can use the UI or the command line:

docker compose run app run_command "settings_show PASSWORD_VALIDATORS"

If the config.yml is invalid or corrupted run and stops the stack from restarting, execute:

docker compose run app run_command settings_revert

to revert to the last known good config.yml file.

Thank you !
I was missing that way of formatting, but now I have no error message but the password length is still at 8 characters.
I tried to set it in the .env file, Mayan did recognize it and put a green checkmark near the AUTH_PASSWORD_VALIDATORS setting, as in, Mayan is recognizing that this setting is coming from an environment variable…but min_length is still 8 chars in practice (changing password says 8 characters minimum, and accepts my 8 chars passwords) !

I’m stuck…

edit : ok we directly changed password_validation.py’s code, but it’s dirty. It’ll work until we find the problem at least.

I was missing that way of formatting, but now I have no error message but the password length is still at 8 characters.
I tried to set it in the .env file, Mayan did recognize it and put a green checkmark near the AUTH_PASSWORD_VALIDATORS setting, as in, Mayan is recognizing that this setting is coming from an environment variable…but min_length is still 8 chars in practice (changing password says 8 characters minimum, and accepts my 8 chars passwords) !

Made a note to test this. Will check to make sure it is not a new bug.