UPD: enable stronger password validation and eventually warning message on login
All checks were successful
buildbot/tox Build done.
All checks were successful
buildbot/tox Build done.
This commit is contained in:
@@ -56,15 +56,15 @@ class PasswordScoreValidator(object):
|
||||
score, used_classes = self._get_score(password, user=user)
|
||||
|
||||
if used_classes < self.min_classes:
|
||||
raise ValidationError(_(u'The password must contain characters from at least %(min_classes)d'
|
||||
u' different character classes (i.e. lower, upper, digits, others).'),
|
||||
raise ValidationError(_(u'Das Passwort muss Zeichen aus mindestens %(min_classes)d'
|
||||
u' verschiedenen Arten von Zeichen bestehen'
|
||||
u' (d.h. Kleinbuchstaben, Großbuchstaben, Ziffern und Sonderzeichen).'),
|
||||
code='too_few_classes',
|
||||
params={'min_classes': self.min_classes})
|
||||
|
||||
if score < self.min_score:
|
||||
raise ValidationError(_(u'The password is too simple. Use more characters'
|
||||
u' and maybe use more different character classes'
|
||||
u' (i.e. lower, upper, digits, others).'),
|
||||
raise ValidationError(_(u'Dieses Passwort ist zu einfach. Benutze mehr Zeichen'
|
||||
u' und gegebenenfalls auch Großbuchstaben, Ziffern und Sonderzeichen.'),
|
||||
code='too_little_score')
|
||||
|
||||
return score
|
||||
@@ -116,7 +116,7 @@ class CustomWordlistPasswordValidator(object):
|
||||
lower_pw = password.lower()
|
||||
for word in self.words:
|
||||
if word in lower_pw:
|
||||
error = ValidationError(_(u'The password must not contain the word \'%(word)s\''),
|
||||
error = ValidationError(_(u'Das Passwort darf nicht die Zeichenfolge \'%(word)s\' enthalten.'),
|
||||
code='forbidden_word',
|
||||
params={'word': word})
|
||||
errors.append(error)
|
||||
@@ -166,23 +166,23 @@ class CharacterClassPasswordValidator(object):
|
||||
def validate(self, password, user=None):
|
||||
errors = []
|
||||
if not self._is_enough_lower(password):
|
||||
error = ValidationError(_(u'The password must contain at least %(min_lower)d characters from a-z'),
|
||||
error = ValidationError(_(u'Das Passwort muss mindestens %(min_lower)d Kleinbuchstaben enthalten.'),
|
||||
code='too_few_lower_characters',
|
||||
params={'min_lower': self.minimum_lower})
|
||||
errors.append(error)
|
||||
if not self._is_enough_upper(password):
|
||||
error = ValidationError(_(u'The password must contain at least %(min_upper)d characters from A-Z'),
|
||||
error = ValidationError(_(u'Das Passwort muss mindestens %(min_upper)d Großbuchstaben enthalten.'),
|
||||
code='too_few_upper_characters',
|
||||
params={'min_upper': self.minimum_upper})
|
||||
errors.append(error)
|
||||
if not self._is_enough_digits(password):
|
||||
error = ValidationError(_(u'The password must contain at least %(min_digits)d digits from 0-9'),
|
||||
error = ValidationError(_(u'Das Passwort muss mindestens %(min_digits)d Ziffern enthalten.'),
|
||||
code='too_few_digits',
|
||||
params={'min_digits': self.minimum_digits})
|
||||
errors.append(error)
|
||||
if not self._is_enough_others(password):
|
||||
error = ValidationError(_(u'The password must contain at least %(min_others)d'
|
||||
u' non alpha numeric characters'),
|
||||
error = ValidationError(_(u'Das Passwort muss mindestens %(min_others)d'
|
||||
u' Sonderzeichen enthalten.'),
|
||||
code='too_few_other_characters',
|
||||
params={'min_others': self.minimum_others})
|
||||
errors.append(error)
|
||||
|
||||
Reference in New Issue
Block a user