changes to check password length
This commit is contained in:
parent
5b7d67838b
commit
72ac665453
3 changed files with 8 additions and 2 deletions
|
@ -11,7 +11,7 @@ To change the password for {{user}}, please supply
|
|||
{% csrf_token %}
|
||||
<br>The old password:<br>
|
||||
<input type="password" name="oldpassword" id="oldpassword">
|
||||
<br><br>The new password:<br>
|
||||
<br><br>The new password (at least 8 characters):<br>
|
||||
<input type="password" name="password1" id="password1">
|
||||
<br>Please repeat the new Password:<br>
|
||||
<input type="password" name="password2" id="password2">
|
||||
|
|
|
@ -12,7 +12,7 @@ To register yourself an user, please fill out the fields below:
|
|||
{% csrf_token %}
|
||||
<br>Username (alphanumeric):<br>
|
||||
<input type="text" name="username" id="username">
|
||||
<br>Password:<br>
|
||||
<br>Password (at least 8 characters):<br>
|
||||
<input type="password" name="password1" id="password1">
|
||||
<br>Please confirm your Password:<br>
|
||||
<input type="password" name="password2" id="password2">
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue