Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(".passwordForm").submit(function(e) {
- e.preventDefault();
- var t = $(this);
- var passwords = [ $(".pass_1").val(), $(".pass_2").val(), $(".pass_new").val() ];
- var error = false;
- $(passwords).each(function(index) {
- if(!passwords[i].length || passwords[i].length <= 4 || passwords[i].length >= 20) {
- var error = true;
- alert("Password was legit.");
- } else {
- alert("Password error.");
- }
- });
- if(error == true) {
- alert ('There was an error');
- } else {
- if(passwords[0] != passwords[1]) {
- alert ('The two entered passwords do not match');
- } else {
- // Passwords do match, check the old password.
- $.post("updatedatabase.php?Username=<?php echo $user; ?>", { pass: passwords[2] }, function(returnStatus) {
- if(returnStatus == "success") {
- //They match
- $(".passwordForm").submit();
- } else {
- alert ('There was an error while prossesing');
- }
- }, "text");
- }
- }
- });
Add Comment
Please, Sign In to add comment