diff --git a/v2/mfa/email-sms-otp/otp-for-opt-in-users.mdx b/v2/mfa/email-sms-otp/otp-for-opt-in-users.mdx index 840b3c4aa..709735f0d 100644 --- a/v2/mfa/email-sms-otp/otp-for-opt-in-users.mdx +++ b/v2/mfa/email-sms-otp/otp-for-opt-in-users.mdx @@ -424,7 +424,7 @@ supertokens.init({ getMFARequirementsForAuth: async function (input) { let roles = await UserRoles.getRolesForUser(input.tenantId, (await input.user).id) // highlight-next-line - if (roles.roles.includes("admin") && await shouldRequireOTPEmailForTenant(input.tenantId)) { + if (roles.roles.includes("admin") && (await input.requiredSecondaryFactorsForTenant).includes("otp-email")) { // we only want otp-email for admins return ["otp-email"] } else { @@ -438,13 +438,6 @@ supertokens.init({ }) ] }) - -// highlight-start -async function shouldRequireOTPEmailForTenant(tenantId: string): Promise { - // your logic here to determine if we care about otp-email for this tenant or not. - return true; -} -// highlight-end ``` @@ -544,7 +537,7 @@ supertokens.init({ ...originalImplementation, getMFARequirementsForAuth: async function (input) { if ((await input.requiredSecondaryFactorsForUser).includes("otp-email")) { - if (await shouldRequireOTPEmailForTenant(input.tenantId)) { + if ((await input.requiredSecondaryFactorsForTenant).includes("otp-email")) { return ["otp-email"] } } @@ -558,13 +551,6 @@ supertokens.init({ }) ] }) - -// highlight-start -async function shouldRequireOTPEmailForTenant(tenantId: string): Promise { - // your logic here to determine if we care about otp-email for this tenant or not. - return true; -} -// highlight-end ``` diff --git a/v2/mfa/totp/totp-for-opt-in-users.mdx b/v2/mfa/totp/totp-for-opt-in-users.mdx index ccee0fda5..7bf3b3f68 100644 --- a/v2/mfa/totp/totp-for-opt-in-users.mdx +++ b/v2/mfa/totp/totp-for-opt-in-users.mdx @@ -611,7 +611,7 @@ supertokens.init({ getMFARequirementsForAuth: async function (input) { let roles = await UserRoles.getRolesForUser(input.tenantId, (await input.user).id) // highlight-next-line - if (roles.roles.includes("admin") && await shouldRequireTotpForTenant(input.tenantId)) { + if (roles.roles.includes("admin") && (await input.requiredSecondaryFactorsForTenant).includes("totp")) { // we only want totp for admins return ["totp"] } else { @@ -625,13 +625,6 @@ supertokens.init({ }) ] }) - -// highlight-start -async function shouldRequireTotpForTenant(tenantId: string): Promise { - // your logic here to determine if we care about totp for this tenant or not. - return true; -} -// highlight-end ``` @@ -710,7 +703,7 @@ supertokens.init({ getMFARequirementsForAuth: async function (input) { if ((await input.requiredSecondaryFactorsForUser).includes("totp")) { // this means that the user has finished setting up a device from their settings page. - if (await shouldRequireTotpForTenant(input.tenantId)) { + if ((await input.requiredSecondaryFactorsForTenant).includes("totp")) { return ["totp"] } } @@ -724,13 +717,6 @@ supertokens.init({ }) ] }) - -// highlight-start -async function shouldRequireTotpForTenant(tenantId: string): Promise { - // your logic here to determine if we care about totp for this tenant or not. - return true; -} -// highlight-end ```