Skip to content

Commit

Permalink
fix: self-review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Dec 11, 2023
1 parent e865afc commit 9a7a04e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
10 changes: 2 additions & 8 deletions lib/build/passwordless-shared4.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 2 additions & 9 deletions lib/ts/recipe/passwordless/components/features/mfa/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ import {
useRethrowInRender,
} from "../../../../../utils";
import MultiFactorAuth from "../../../../multifactorauth/recipe";
import { useDynamicLoginMethods } from "../../../../multitenancy/dynamicLoginMethodsContext";
import SessionRecipe from "../../../../session/recipe";
import { getPhoneNumberUtils } from "../../../phoneNumberUtils";
import { getEnabledContactMethods } from "../../../utils";
import MFAThemeWrapper from "../../themes/mfa";
import { defaultTranslationsPasswordless } from "../../themes/translations";

Expand Down Expand Up @@ -317,7 +315,7 @@ function useOnLoad(
() => dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }),
[dispatch]
);
const dynamicLoginMethods = useDynamicLoginMethods();

const onLoad = React.useCallback(
async (mfaInfo: { factors: MFAFactorInfo; email?: string; phoneNumber?: string }) => {
let error: string | undefined = undefined;
Expand All @@ -341,12 +339,7 @@ function useOnLoad(
? mfaInfo.factors.isAllowedToSetup.includes("otp-email")
: mfaInfo.factors.isAllowedToSetup.includes("otp-phone");

const enabledContactMethods = getEnabledContactMethods(
props.recipe.config.contactMethod,
dynamicLoginMethods
);

if (loginAttemptInfo && !enabledContactMethods.includes(loginAttemptInfo.contactMethod)) {
if (loginAttemptInfo && props.contactMethod !== loginAttemptInfo.contactMethod) {
await recipeImplementation?.clearLoginAttemptInfo({ userContext });
loginAttemptInfo = undefined;
}
Expand Down

0 comments on commit 9a7a04e

Please sign in to comment.