Esempio n. 1
0
    session_destroy();
    header("Location: /");
    exit;
}
// Authenticate using WebID
if (strlen($auth->webid) > 0 || isset($_REQUEST["recovery_code"]) || isset($_REQUEST["pairing_pin"])) {
    $ok = False;
    // Authenticated through WebID-TLS
    if (strlen($auth->webid) > 0 && $auth->isAuthenticated() == True) {
        $webid = $auth->webid;
        $ok = True;
    }
    // Authenticate through recovery hash
    if (strlen($_REQUEST["recovery_code"]) > 0) {
        $recovery = new Recovery();
        $status = $recovery->hash_authenticated($_REQUEST["recovery_code"]);
        if ($status == True) {
            $webid = $recovery->get_webid();
            $_SESSION['recovery_status'] = null;
            $ok = True;
        } else {
            $_SESSION['recovery_status'] = error('Your recovery code does not match any records in our database.');
        }
    }
    if (strlen($_REQUEST["pairing_pin"]) > 0) {
        $recovery = new Recovery();
        $status = $recovery->pin_authenticated($_REQUEST["pairing_pin"]);
        if ($status == True) {
            $webid = $recovery->get_webid();
            $_SESSION['recovery_status'] = null;
            $ok = True;