Merge pull request #950 from alphagov/8-char-password

Reduce minimum password length to 8 characters
This commit is contained in:
Chris Hill-Scott
2016-09-28 14:34:02 +01:00
committed by GitHub
6 changed files with 2115 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -72,8 +72,8 @@ def mobile_number():
def password(label='Password'):
return PasswordField(label,
validators=[DataRequired(message='Cant be empty'),
Length(10, 255, message='Must be at least 10 characters'),
Blacklist(message='That password is blacklisted, too common')])
Length(8, 255, message='Must be at least 8 characters'),
Blacklist(message='Choose a password thats harder to guess')])
def sms_code():

View File

@@ -2,6 +2,7 @@ import re
from wtforms import ValidationError
from notifications_utils.template import Template
from app.utils import Spreadsheet
from ._blacklisted_passwords import blacklisted_passwords
class Blacklist(object):
@@ -11,7 +12,7 @@ class Blacklist(object):
self.message = message
def __call__(self, form, field):
if field.data in ['password1234', 'passw0rd1234']:
if field.data in blacklisted_passwords:
raise ValidationError(self.message)