diff --git a/web/apps/auth/src/pages/auth.tsx b/web/apps/auth/src/pages/auth.tsx index c5c328a42..02d32edc7 100644 --- a/web/apps/auth/src/pages/auth.tsx +++ b/web/apps/auth/src/pages/auth.tsx @@ -176,10 +176,11 @@ const CodeDisplay: React.FC = ({ codeInfo }) => { try { const currentTime = new Date().getTime(); if (codeInfo.type.toLowerCase() === "totp") { + console.log({ codeInfo }); const totp = new TOTP({ secret: codeInfo.secret, algorithm: codeInfo.algorithm ?? Code.defaultAlgo, - period: codeInfo.period ?? Code.defaultPeriod, + period: codeInfo.period, digits: codeInfo.digits, }); setOTP(totp.generate()); @@ -274,7 +275,7 @@ const OTPDisplay: React.FC = ({ code, otp, nextOTP }) => { overflow: "hidden", }} > - +
{ _getAccount(uriPath), _getIssuer(uriPath, uriParams), _getDigits(uriParams) || 6, - _getPeriod(uriParams), + _getPeriod(uriParams) || 30, getSanitizedSecret(uriParams), _getAlgorithm(uriParams), _getType(uriPath), @@ -138,11 +137,11 @@ const _getDigits = (uriParams): number | undefined => { } }; -const _getPeriod = (uriParams): number => { +const _getPeriod = (uriParams): number | undefined => { try { - return parseInt(uriParams["period"], 10) || Code.defaultPeriod; + return parseInt(uriParams["period"], 10); } catch (e) { - return Code.defaultPeriod; + return undefined; } };