Advertisement
Guest User

Untitled

a guest
Oct 4th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. if 'passwordSubmit' in request.POST:
  2. updatePassword = updatePasswordForm(request.POST)
  3. if updatePassword.is_valid():
  4. cd = updatePassword.cleaned_data
  5. old_password = cd['old_password']
  6. new_password = cd['new_password']
  7. verify_password = cd['verify_password']
  8. user = authenticate(username=currentUser.username, password=old_password)
  9. if user is not None:
  10. if new_password == verify_password:
  11. secure_password = make_password(new_password)
  12. update_user = currentUser
  13. update_user.password = secured_password
  14. update_user.save()
  15. else:
  16. message = 'The two passwords do not match'
  17. # if the passwords do no match
  18. else:
  19. message = 'The password entered does not match our records'
  20. # in case the old password is not what is saved in the database
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement