Exemplo n.º 1
0
/**
 * Validates the user email, updates the activation code of the user and sends a reset password email.
 * @author Raafat
 * @param  string $email The unique email address of the user.
 * @return boolean True if the email was sent and false otherwise.
 */
function resetPassword($email)
{
    $email = fixEmail($email);
    if (!userExists($email)) {
        return ACCOUNT_NOT_FOUND_ERR;
    }
    $u = getUserIdByEmail($email);
    $user_id = $u["user_id"];
    $code = updateCode($user_id);
    return sendResetMail($email, $user_id, $code);
}
Exemplo n.º 2
0
$page_title = "TutorMe Reset Profile";
require_once "/html/html_header.html";
?>

    <div id="content">
        <div id="main-content">
            <h4 class="text-center"><span class="title">TutorMe</span> Account Activation</h4>
        <?php 
require_once CLASSES_PATH . "InfoManager.php";
$false_info = "<p> This account does not exist in our system! </p>" . $redirect_script;
# requested password reset...
if (isset($_POST["user_email"])) {
    $email = $_POST["user_email"];
    if (userExists($email) === true) {
        $user_id = getUserIdByEmail($email);
        sendResetMail($email, $user_id, updateCode($user_id));
        echo "<p> An email with instructions to reset your password was sent to your inbox. </p>";
    } else {
        echo $false_info;
    }
} else {
    if (isset($_GET["id"], $_GET["code"])) {
        # checking reset password link...
        $id = $_GET["id"];
        $code = $_GET["code"];
        $u = getFullUserById($id);
        $valid = true;
        if ($u === null) {
            echo $false_info;
            $valid = false;
        }