mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-27 14:08:46 +00: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) {
|
||||||
if (result.error.code === "INVALID_TWO_FACTOR_AUTHENTICATION") {
|
if (result.error.code === "INVALID_CODE") {
|
||||||
toast.error("Invalid verification code");
|
toast.error("Invalid verification code");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user