find((int)$userId); if ($user && (int)$user['two_factor_enabled'] === 1) { $isVerified = $_SESSION['2fa_verified'] ?? false; if (!$isVerified) { Response::error("2FA Required: บัญชีของท่านเปิดใช้งาน 2-Factor Authentication กรุณายืนยันรหัส TOTP 6 หลักจาก Google Authenticator ก่อนใช้งาน", 403, [ 'require_2fa' => true, 'redirect' => '/verify-2fa', ]); } } } }