added unit tests
This commit is contained in:
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user