1 Commits

Author SHA1 Message Date
Sebastian 193d92049e Update dependency vue to v3.5.40 2026-07-18 03:03:28 +00:00
5 changed files with 11 additions and 20 deletions
+1 -8
View File
@@ -128,7 +128,7 @@ class EnrollmentController extends ControllerAbstract
/** /**
* Remove TOTP enrollment (disable 2FA) * Remove TOTP enrollment (disable 2FA)
*/ */
#[AuthenticatedRoute('/totp/enroll/remove', name: 'totp.enroll.remove', methods: ['POST'])] #[AuthenticatedRoute('/totp/enroll', name: 'totp.enroll.remove', methods: ['DELETE'])]
public function removeEnrollment(string $code): JsonResponse public function removeEnrollment(string $code): JsonResponse
{ {
$userId = $this->userIdentity->identifier(); $userId = $this->userIdentity->identifier();
@@ -139,13 +139,6 @@ class EnrollmentController extends ControllerAbstract
); );
} }
if (empty($code)) {
return new JsonResponse(
['error' => 'Verification code is required', 'error_code' => 'invalid_request'],
JsonResponse::HTTP_BAD_REQUEST
);
}
// Verify current code before removing // Verify current code before removing
$verifyResult = $this->enrollmentService->verifyCode($userId, $code); $verifyResult = $this->enrollmentService->verifyCode($userId, $code);
if (!$verifyResult['success']) { if (!$verifyResult['success']) {
+1 -1
View File
@@ -128,7 +128,7 @@ class EnrollmentService
} }
// Verify the code // Verify the code
if (!$this->verifyTotpCode($enrollment['secret'], $code)) { if (!$this->verifyCode($enrollment['secret'], $code)) {
return [ return [
'success' => false, 'success' => false,
'error' => 'Invalid verification code', 'error' => 'Invalid verification code',
+6 -7
View File
@@ -116,9 +116,9 @@ class EnrollmentStore
} }
/** /**
* Get unused recovery codes for a user, keyed by their original index * Get unused recovery codes for a user
* *
* @return array<int, string> Unused recovery codes * @return array<string> Unused recovery codes
*/ */
public function getRecoveryCodes(string $tenantId, string $userId): array public function getRecoveryCodes(string $tenantId, string $userId): array
{ {
@@ -130,15 +130,14 @@ class EnrollmentStore
$codes = $enrollment['recovery_codes'] ?? []; $codes = $enrollment['recovery_codes'] ?? [];
$usedIndices = $enrollment['used_recovery_codes'] ?? []; $usedIndices = $enrollment['used_recovery_codes'] ?? [];
// Filter out used codes, preserving original indices so callers // Filter out used codes
// can mark the correct code as used
$result = []; $result = [];
foreach ($codes as $index => $code) { foreach ($codes as $index => $code) {
if (!in_array($index, $usedIndices, true)) { if (!in_array($index, $usedIndices, true)) {
$result[$index] = $code; $result[] = $code;
} }
} }
return $result; return $result;
} }
+2 -4
View File
@@ -140,11 +140,9 @@ async function disableTotp() {
disableError.value = '' disableError.value = ''
try { try {
const response = await fetch(`${apiBase}/totp/enroll/remove`, { const response = await fetch(`${apiBase}/totp/enroll?code=${encodeURIComponent(disableCode.value)}`, {
method: 'POST', method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
credentials: 'include', credentials: 'include',
body: JSON.stringify({ code: disableCode.value }),
}) })
const data = await response.json() const data = await response.json()
+1
View File
@@ -6,6 +6,7 @@
"composite": true, "composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"baseUrl": ".",
"paths": { "paths": {
"@/*": ["./src/*"], "@/*": ["./src/*"],
"@KTXC/*": ["../../core/src/*"] "@KTXC/*": ["../../core/src/*"]