Example #1
0
// if there is an active log in process redirect to students.class.php; load page only if no
// logged in user exists
$general->loggedInProtect();
$pageTitle = "Log In";
if (isUpdatePasswordBtnPressed()) {
    // The email link you clicked does not belong to any account.
    //<br/>Make sure that you did not modified the link you retreived on your email.
    try {
        if (!isUrlOriginal()) {
            throw new Exception("It seems you've modified the email url we send you. Please click the original link to proceed.");
        }
        $newPassword1 = $_POST['new-password-1'];
        $newPassword2 = $_POST['new-password-2'];
        $id = $_GET['id'];
        $genString = $_GET['gen_string'];
        User::addNewPassword($id, $newPassword1, $newPassword2, $genString);
        header('Location: ' . BASE_URL . 'login/set/success');
        exit;
    } catch (Exception $e) {
        $errors[] = $e->getMessage();
    }
    #redirect the user to recover.php?success if recover() function does not return false.
    //header('Location: ' . BASE_URL . 'login/recover/success');
    //exit();
}
function isUpdatePasswordBtnPressed()
{
    return isset($_POST['form_action_update_password']) && empty($_POST['form_action_update_password']);
}
/**
 * @return bool