mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(console): auto close mfa switch (#6895)
This commit is contained in:
parent
7556c16849
commit
d26d9aaa88
1 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { MfaFactor, MfaPolicy, type SignInExperience } from '@logto/schemas';
|
import { MfaFactor, MfaPolicy, type SignInExperience } from '@logto/schemas';
|
||||||
import { useContext, useMemo } from 'react';
|
import { useContext, useEffect, useMemo } from 'react';
|
||||||
import { Controller, useForm } from 'react-hook-form';
|
import { Controller, useForm } from 'react-hook-form';
|
||||||
import { toast } from 'react-hot-toast';
|
import { toast } from 'react-hot-toast';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
@ -68,6 +68,13 @@ function MfaForm({ data, onMfaUpdated }: Props) {
|
||||||
return factors.length === 0;
|
return factors.length === 0;
|
||||||
}, [formValues, isMfaDisabled]);
|
}, [formValues, isMfaDisabled]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Reset the `isMandatory` to false when the policy settings are disabled
|
||||||
|
if (isPolicySettingsDisabled) {
|
||||||
|
reset({ ...formValues, isMandatory: false });
|
||||||
|
}
|
||||||
|
}, [isPolicySettingsDisabled, reset, formValues]);
|
||||||
|
|
||||||
const mfaPolicyOptions = useMemo(
|
const mfaPolicyOptions = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue