Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if 'passwordSubmit' in request.POST:
- updatePassword = updatePasswordForm(request.POST)
- if updatePassword.is_valid():
- cd = updatePassword.cleaned_data
- old_password = cd['old_password']
- new_password = cd['new_password']
- verify_password = cd['verify_password']
- user = authenticate(username=currentUser.username, password=old_password)
- if user is not None:
- if new_password == verify_password:
- secure_password = make_password(new_password)
- update_user = currentUser
- update_user.password = secured_password
- update_user.save()
- else:
- message = 'The two passwords do not match'
- # if the passwords do no match
- else:
- message = 'The password entered does not match our records'
- # in case the old password is not what is saved in the database
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement