mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-21 22:05:23 +02:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user