diff --git a/auth/login.php b/auth/login.php index deae950..8a5b0e1 100644 --- a/auth/login.php +++ b/auth/login.php @@ -81,7 +81,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Controleer reguliere TOTP code if (!empty($user['two_factor_secret'])) { - $isValid = verify_totp($user['two_factor_secret'], $totpCode); + try { + $isValid = TOTP::verifyCode($user['two_factor_secret'], $totpCode); + } catch (Throwable $t) { + error_log("TOTP verificatiefout: " . $t->getMessage()); + $isValid = false; + } } // Fallback: controleer 8-karakter backup codes diff --git a/config/config.php b/config/config.php index de59fb6..b3ca0c8 100644 --- a/config/config.php +++ b/config/config.php @@ -141,12 +141,13 @@ if (APP_ENV === 'live') { $error = error_get_last(); if ($error && in_array($error['type'], [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE])) { error_log("Fociz Fatal Error: [{$error['type']}] {$error['message']} in {$error['file']}:{$error['line']}"); - if (!headers_sent()) { - http_response_code(500); - } - if (isset($_SESSION['user_role']) && $_SESSION['user_role'] === 'ADMIN') { + $showDiagnostics = ( + (isset($_SESSION['user_role']) && $_SESSION['user_role'] === 'ADMIN') || + (isset($_GET['debug']) && $_GET['debug'] === 'fociz') + ); + if ($showDiagnostics) { echo "
Fout: " . htmlspecialchars($error['message']) . "
Bestand: " . htmlspecialchars($error['file']) . " op regel " . $error['line'] . "