X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=testing%2FMCTXWeb%2Fpublic_html%2Fusers%2Fuser_change_details.php;fp=testing%2FMCTXWeb%2Fpublic_html%2Fusers%2Fuser_change_details.php;h=16c4532699af34f1f8692d95a02b91df7cb51ba7;hb=828cdbf49f52572e93c5c5a48e05277525a4055f;hp=0000000000000000000000000000000000000000;hpb=5303f53cb44fffd4c59890d3c333f74d7cd7cb4e;p=matches%2FMCTX3420.git diff --git a/testing/MCTXWeb/public_html/users/user_change_details.php b/testing/MCTXWeb/public_html/users/user_change_details.php new file mode 100644 index 0000000..16c4532 --- /dev/null +++ b/testing/MCTXWeb/public_html/users/user_change_details.php @@ -0,0 +1,169 @@ +email = $userdetails["email"]; + $loggedInUser->user_id = $userdetails["id"]; + $loggedInUser->hash_pw = $userdetails["password"]; + $loggedInUser->title = $userdetails["title"]; + $loggedInUser->displayname = $userdetails["display_name"]; + $loggedInUser->username = $userdetails["user_name"]; + + if(trim($password_new) == "") + { + $errors[] = lang("ACCOUNT_SPECIFY_NEW_PASSWORD"); + } + else if(trim($password_confirm) == "") + { + $errors[] = lang("ACCOUNT_SPECIFY_CONFIRM_PASSWORD"); + } + else if(minMaxRange(6,50,$password_new)) + { + $errors[] = lang("ACCOUNT_NEW_PASSWORD_LENGTH",array(6,50)); + } + else if($password_new != $password_confirm) + { + $errors[] = lang("ACCOUNT_PASS_MISMATCH"); + } + + //End data validation + if(count($errors) == 0) + { + //Also prevent updating if someone attempts to update with the same password + $entered_pass_new = generateHash($password_new,$loggedInUser->hash_pw); + + if($entered_pass_new == $loggedInUser->hash_pw) + { + //Don't update, this fool is trying to update with the same password ¬¬ + $errors[] = lang("ACCOUNT_PASSWORD_NOTHING_TO_UPDATE"); + } + else + { + //This function will create the new hash and update the hash_pw property. + $loggedInUser->updatePassword($password_new); + $successes[] = lang("ACCOUNT_PASSWORD_UPDATED"); + } + } + } + } + } + } +} + +if (isUserLoggedIn()) +{ + //If not admin, log them out after pw change + if (!$loggedInUser->checkPermission(array(2))) + { + $loggedInUser->userLogOut(); + } +} + +require_once("models/header.php"); +startPage(); + +echo ' +
+
+
Change of password
+
+

+ +

+

+ +

+

+ +

+

+ +

+

+ Forgotten password? +

+

+ +

+
'; + +echo resultBlock($errors,$successes); +echo ' +
+
+ '; + +finishPage(); + +?>