Configuring totp code when verifying too (#9584)

This commit is contained in:
Leo Giovanetti
2023-06-16 20:08:12 +00:00
committed by GitHub
parent 24ed04e6c7
commit 4a30f60622
@@ -24,6 +24,7 @@ export const verifyCodeHandler = async ({ ctx, input }: VerifyCodeOptions) => {
.update(email + process.env.CALENDSO_ENCRYPTION_KEY)
.digest("hex");
totp.options = { step: 900 };
const isValidToken = totp.check(code, secret);
if (!isValidToken) throw new TRPCError({ code: "BAD_REQUEST", message: "invalid_code" });