From 6d65a36aac8c7abd81874e2860a3c102609e06a6 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Mon, 20 Jul 2026 18:20:56 -0600 Subject: [PATCH] fix(2fa): show correct error for invalid TOTP code The verify-totp handler checked for the error code INVALID_TWO_FACTOR_AUTHENTICATION, which no longer exists in better-auth 1.6.23 (the two-factor plugin now returns INVALID_CODE). As a result, entering a wrong TOTP code fell through to the generic catch and showed "Error verifying 2FA code / Unknown error" instead of a clear "Invalid verification code" message. Match the current better-auth error code so the specific, actionable message is shown. --- .../components/dashboard/settings/profile/enable-2fa.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dokploy/components/dashboard/settings/profile/enable-2fa.tsx b/apps/dokploy/components/dashboard/settings/profile/enable-2fa.tsx index 9a2191a0a..cd053d975 100644 --- a/apps/dokploy/components/dashboard/settings/profile/enable-2fa.tsx +++ b/apps/dokploy/components/dashboard/settings/profile/enable-2fa.tsx @@ -100,7 +100,7 @@ export const Enable2FA = () => { }); if (result.error) { - if (result.error.code === "INVALID_TWO_FACTOR_AUTHENTICATION") { + if (result.error.code === "INVALID_CODE") { toast.error("Invalid verification code"); return; }