Guest User

Untitled

a guest
Apr 25th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. $(".passwordForm").submit(function(e) {
  2. e.preventDefault();
  3. var t = $(this);
  4. var passwords = [ $(".pass_1").val(), $(".pass_2").val(), $(".pass_new").val() ];
  5. var error = false;
  6. $(passwords).each(function(index) {
  7. if(!passwords[i].length || passwords[i].length <= 4 || passwords[i].length >= 20) {
  8. var error = true;
  9. alert("Password was legit.");
  10.  
  11. } else {
  12. alert("Password error.");
  13. }
  14. });
  15. if(error == true) {
  16. alert ('There was an error');
  17. } else {
  18. if(passwords[0] != passwords[1]) {
  19. alert ('The two entered passwords do not match');
  20. } else {
  21. // Passwords do match, check the old password.
  22. $.post("updatedatabase.php?Username=<?php echo $user; ?>", { pass: passwords[2] }, function(returnStatus) {
  23. if(returnStatus == "success") {
  24. //They match
  25. $(".passwordForm").submit();
  26. } else {
  27. alert ('There was an error while prossesing');
  28. }
  29. }, "text");
  30. }
  31. }
  32. });
Add Comment
Please, Sign In to add comment