*/ function get2FAInfo(PDO $pdo, int $userId): array { try { $stmt = $pdo->prepare("SELECT totp_enabled FROM users WHERE id = ?"); $stmt->execute([$userId]); $row = $stmt->fetch(); $r2fa = $pdo->query("SELECT require_2fa FROM company_settings LIMIT 1"); return [ 'totp_enabled' => (bool) ($row['totp_enabled'] ?? false), 'require_2fa' => (bool) $r2fa->fetchColumn(), ]; } catch (PDOException $e) { return ['totp_enabled' => false, 'require_2fa' => false]; } }