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(); ?>