diff --git a/dal/dal/templates/changepassword.html b/dal/dal/templates/changepassword.html index ea21d5e..691d3b0 100644 --- a/dal/dal/templates/changepassword.html +++ b/dal/dal/templates/changepassword.html @@ -11,7 +11,7 @@ To change the password for {{user}}, please supply {% csrf_token %}
The old password:
-

The new password:
+

The new password (at least 8 characters):

Please repeat the new Password:
diff --git a/dal/dal/templates/registeruser.html b/dal/dal/templates/registeruser.html index 17d1683..db923b4 100644 --- a/dal/dal/templates/registeruser.html +++ b/dal/dal/templates/registeruser.html @@ -12,7 +12,7 @@ To register yourself an user, please fill out the fields below: {% csrf_token %}
Username (alphanumeric):
-
Password:
+
Password (at least 8 characters):

Please confirm your Password:
diff --git a/dal/dal/views.py b/dal/dal/views.py index aff11ca..e3ee6d1 100644 --- a/dal/dal/views.py +++ b/dal/dal/views.py @@ -315,6 +315,8 @@ class ResetRequest(View): return render(request, 'error.html', { 'service': service, 'error': 'Please supply a password and confirm it.' } ) if password1 != password2: return render(request, 'error.html', { 'service': service, 'error': 'The supplied passwords do not match.' } ) + if len(password1) < 8: + return render(request, 'error.html', { 'service': service, 'error': 'The password is too short, please use a longer one. At least 8 characters.' } ) # everything checks out, now change the password with get_pool().next() as rpc: pwd = r'%s' % password1 @@ -371,6 +373,10 @@ class ChangePassword(View): if password1 != password2: return render(request, 'error.html', { 'urlname': urlname, 'service': service, 'error': 'Please check if you typed the same password both times for the new password' } ) + # Check for password length + if len(password1) < 8: + return render(request, 'error.html', { 'urlname': urlname, 'service': service, + 'error': 'The password is too short, please use a longer one. At least 8 characters.' } ) with get_pool().next() as rpc: # Trying to change the password pwd = r'%s' % password1