added unit tests

This commit is contained in:
2026-06-04 21:40:59 +02:00
parent d80a8de559
commit 48a619ee4b
64 changed files with 3807 additions and 33 deletions

View File

@ -5,8 +5,6 @@ require_once __DIR__ . '/../lib/settings.php';
$tokenRec = require_valid_token_web();
require_role(['admin'], $tokenRec);
const QDB_REVOKE_ALL_CONFIRM = 'REVOKE ALL SESSIONS';
switch ($method) {
case 'GET':
@ -49,10 +47,11 @@ case 'POST':
json_error('BAD_REQUEST', 'Unknown action', 400);
}
$confirm = trim((string)($body['confirmPhrase'] ?? ''));
if ($confirm !== QDB_REVOKE_ALL_CONFIRM) {
$revokeAllPhrase = 'REVOKE ALL SESSIONS';
if ($confirm !== $revokeAllPhrase) {
json_error(
'CONFIRMATION_REQUIRED',
'Type exactly "' . QDB_REVOKE_ALL_CONFIRM . '" to revoke every session',
'Type exactly "' . $revokeAllPhrase . '" to revoke every session',
400
);
}