change_password() public method

Returns: true: Change success false: Error
public change_password ( $newpass, $newpass_rep )
コード例 #1
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
        $errors["email"] = "Please enter your email address";
    } elseif (!validate_email($email)) {
        $errors["email"] = "Please enter a valid email address";
    } else {
        $USER = new USER();
        $emailexists = $USER->email_exists($email);
        if (!$emailexists) {
            $errors["email"] = 'There is no user registered with that email address. If you are subscribed to email alerts, you are not necessarily registered on the website. If you register, you will be able to manage your email alerts, as well as leave annotations.';
        }
    }
    if (sizeof($errors) > 0) {
        // Validation errors. Print form again.
        display_page($errors);
    } else {
        // Change the user's password!
        $password = $USER->change_password($email);
        if ($password) {
            $success = $USER->send_password_reminder();
            if ($success) {
                print "<p>A new password has been sent to " . _htmlentities($email) . "</p>\n";
            } else {
                $errors["sending"] = "Sorry, there was a technical problem sending the email.";
                display_page($errors);
            }
        } else {
            // This email address isn't in the DB.
            $errors["passwordchange"] = "Sorry, there was a problem and we couldn't set a new password for " . _htmlentities($email);
            display_page($errors);
        }
    }
} else {