question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using Django Password Validators

See original GitHub issue

I see Djoser has it’s own method of providing password validation which does not use the Django AUTH_PASSWORD_VALIDATORS and will not accept identical arguments. Is there a reason for this? Wouldn’t it be simpler to work directly with what is provided by Django auth (https://docs.djangoproject.com/en/1.9/topics/auth/passwords/) ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
pszpetkowskicommented, Jun 16, 2017

After discussing the matter internally with @haxoza and @michalbon we believe that https://github.com/orcasgit/django-password-validation will be a solution for for Django 1.8 users, so I suppose that we might as well get rid of PASSWORD_VALIDATORS from Djoser settings for 0.7.0 and we will simply use Django Password Validation as we should.

2reactions
moatazsolicommented, Apr 27, 2017

You can do this in your settings.py

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

Then also in settings.py for DJOSER Settings:


from django.contrib.auth import password_validation

DJOSER = {
    'PASSWORD_RESET_CONFIRM_URL': '#/password/reset/confirm/{uid}/{token}',
    'ACTIVATION_URL': '#/activate/{uid}/{token}',
    'PASSWORD_VALIDATORS': [password_validation.validate_password]
}

works for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django Shorts — Password validators | by Nuno Bispo - Medium
It's quite easy to write a custom password validator to use with Django. All is needed is to create a class that implements...
Read more >
django-password-validators - PyPI
Validator checks if the password was once used by a particular user. If the password is used, then an exception is thrown, of...
Read more >
How to Create Custom Password Validators in Django
If you have more specific needs, you can create your own validators. To do so, simply create your own classes based on object...
Read more >
Django - Adding password validations in a ModelForm
from django.contrib.auth.models import User ; from django import forms ; class user_form(forms.ModelForm): password = forms.CharField(widget = ...
Read more >
django-password-validators - Python package - Snyk
Additional libraries for validating passwords in Django 2.2.25 or later. django-password-validators requires Django 2.2.25 or greater. The application works ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found