From 14e7ae2cae4e6aae9be99e1e547efe018716ba51 Mon Sep 17 00:00:00 2001 From: Ankur Bansal <85155003+AnkurBansalSF@users.noreply.github.com> Date: Thu, 5 May 2022 16:36:36 +0530 Subject: [PATCH] fix(provider): minor fix in otp strategy (#70) minor fix in OTP strategy, and added few error keys gh-69 --- src/error-keys.ts | 3 +++ src/strategies/passport/passport-otp/otp-auth.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/error-keys.ts b/src/error-keys.ts index 38f29aa..fb62b45 100644 --- a/src/error-keys.ts +++ b/src/error-keys.ts @@ -9,4 +9,7 @@ export const enum AuthErrorKeys { InvalidCredentials = 'Invalid Credentials', UnknownError = 'Unknown Error', WrongPassword = 'Incorrect Password', + KeyInvalid = 'Key Invalid', + OtpInvalid = 'Otp Invalid', + OtpExpired = 'Otp Token Incorrect or Expired', } diff --git a/src/strategies/passport/passport-otp/otp-auth.ts b/src/strategies/passport/passport-otp/otp-auth.ts index 594366a..bf16465 100644 --- a/src/strategies/passport/passport-otp/otp-auth.ts +++ b/src/strategies/passport/passport-otp/otp-auth.ts @@ -37,7 +37,7 @@ export namespace Otp { const key = req.body.key || options?.key; const otp = req.body.otp || options?.otp; - if (!key || !otp) { + if (!key) { this.fail(); return; }