Configuring totp code when verifying too (#9584)

pull/9588/head
Leo Giovanetti 2023-06-16 17:08:12 -03:00 committed by GitHub
parent 24ed04e6c7
commit 4a30f60622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -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" });