Bonjour à tous !

Voilà, je suis sur Django et j'ai fait une fonction qui permet de vérifier qu'un mot de passe contient bien une minuscule, un majuscule, etc. Mais elle n'est pas prise en compte dans mon site pourtant j'ai bien mis à jour mon settings.py. Je vous mets en dessous le code en question.

settings.py :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import os
 
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
 
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
 
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'u&7y6vuqfafc+-iit%g_7r07f2*%phe&bzd$xm=n&__4^$fy+e'
 
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
 
ALLOWED_HOSTS = []
 
 
# Application definition
 
INSTALLED_APPS = [
    'store.apps.StoreConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]
 
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
 
ROOT_URLCONF = 'purbeurre_project.urls'
 
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
 
WSGI_APPLICATION = 'purbeurre_project.wsgi.application'
 
 
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
 
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'purbeurre',
        'USER': 'postgres',
        'PASSWORD': 'password',
        'HOST': '',
        'PORT': '5432',
    }
}
 
 
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
 
AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'purbeurre_project.store.validators.NumberValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'OPTIONS': {
            'min_length': 7,
        }
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'purbeurre_project.store.validators.UppercaseValidator',
    },
    {
        'NAME': 'purbeurre_project.store.validators.LowercaseValidator'
    },
    {
        'NAME': 'purbeurre_project.store.validators.SymbolValidator'
    },
]
 
 
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
 
LANGUAGE_CODE = 'fr'
 
TIME_ZONE = 'Europe/Paris'
 
USE_I18N = True
 
USE_L10N = True
 
USE_TZ = True
 
 
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
 
STATIC_URL = '/static/'
 
INTERNAL_IPS = ['127.0.0.1']
validators.py :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import re
 
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
 
 
class NumberValidator(object):
    def validate(self, password, user=None):
        if not re.findall('\d', password):
            raise ValidationError(
                _("Votre mot de passe doit contenir au moins un chiffre."),
                code='password_no_number',
            )
 
    def get_help_text(self):
        return _(
            "Votre mot de passe doit contenir au moins un chiffre."
        )
 
 
class UppercaseValidator(object):
    def validate(self, password, user=None):
        if not re.findall('[A-Z]', password):
            raise ValidationError(
                _("Votre mot de passe doit contenir au moins une lettre majuscule."),
                code='password_no_upper',
            )
 
    def get_help_text(self):
        return _(
            "Votre mot de passe doit contenir au moins une lettre majuscule."
        )
 
 
class LowercaseValidator(object):
    def validate(self, password, user=None):
        if not re.findall('[a-z]', password):
            raise ValidationError(
                _("Votre mot de passe doit contenir au moins une lettre minuscule."),
                code='password_no_lower',
            )
 
    def get_help_text(self):
        return _(
            "Votre mot de passe doit contenir au moins une lettre minuscule."
        )
 
 
class SymbolValidator(object):
    def validate(self, password, user=None):
        if not re.findall('[()[\]{}|\\`~!@#$%^&*_\-+=;:\'",<>./?]', password):
            raise ValidationError(
                _("Votre mot de passe doit contenir au moins un caractère spécial : " +
                  "()[]{}|\`~!@#$%^&*_-+=;:'\",<>./?"),
                code='password_no_symbol',
            )
 
    def get_help_text(self):
        return _(
            "Votre mot de passe doit contenir au moins un caractère spécial : " +
            "()[]{}|\`~!@#$%^&*_-+=;:'\",<>./?"
        )
Je vois pas d'erreur flagrante, est-ce que vous pourriez m'aider ?

Merci à tous !