1
0
Fork 0

Add flaw 4: weak passwords allowed

This commit is contained in:
Vili Sinervä 2024-11-25 17:16:29 +02:00
parent 05fec8a837
commit e8f671d66e
No known key found for this signature in database
GPG key ID: DF8FEAF54EFAC996
3 changed files with 16 additions and 6 deletions

View file

@ -99,11 +99,13 @@ def register_view(request):
# Password validation
if password1 != password2:
errors.append("Passwords don't match.")
try:
validate_password(password1)
except ValidationError as error:
for message in error.messages:
errors.append(message)
# FLAW 4:
# Adding some sensible password validation would fix the problem
# try:
# validate_password(password1)
# except ValidationError as error:
# for message in error.messages:
# errors.append(message)
if not errors:
user = User.objects.create_user(username=username, password=password1)