Files
2026-11-17 12:59:54 +01:00

19 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
if (!getenv('NEXTFLOOR_TEST_STATE')) { echo "Local authentication browser-test fixture; NEXTFLOOR_TEST_STATE required.\n"; exit; }
require __DIR__ . '/support/access-runtime.php';
$module = new AccessFixtureModule(); initializeAccessFixture($module);
$path = parse_url((string) $_SERVER['REQUEST_URI'], PHP_URL_PATH);
if ($path === '/__test/console') { header('Content-Type: application/json'); echo json_encode(['url' => substr($module->OpenDesigner(), 5)]); return; }
if ($path === '/__test/state') {
header('Content-Type: application/json');
echo json_encode(['writes' => $fixture['writes'], 'accounts' => array_map(static fn(array $a): array => ['name' => $a['name'], 'enabled' => $a['enabled']], json_decode($fixture['attributes']['Accounts'], true))]); return;
}
if ($path === '/__test/reset' && $_SERVER['REQUEST_METHOD'] === 'POST') {
$data = json_decode((string) file_get_contents('php://input'), true);
$accounts = json_decode($fixture['attributes']['Accounts'], true);
foreach ($accounts as $id => $a) if ($a['name'] === ($data['name'] ?? '')) { echo $module->ResetUserPassword($id, (string) ($data['password'] ?? '')); return; }
}
$module->hook();