@@ -36,6 +36,7 @@ import {
3636 IconShieldLock
3737} from "@tabler/icons-react" ;
3838import { UserSessionsDataTableComponent } from "@edition/user/components/UserSessionsDataTableComponent" ;
39+ import { useMfa } from "@edition/user/components/MfaProviderComponent" ;
3940import { UserMfaView } from "@edition/user/views/UserMfaView" ;
4041import { SettingDialog } from "@core/components/SettingDialog" ;
4142
@@ -51,6 +52,7 @@ export const UserEditDialogComponent: React.FC<UserEditDialogComponentProps> = (
5152
5253 const userService = useService ( UserService )
5354 const userStore = useStore ( UserService )
55+ const withMfa = useMfa ( )
5456 const [ , startTransition ] = React . useTransition ( )
5557
5658 const currentSession = useUserSession ( )
@@ -132,11 +134,12 @@ export const UserEditDialogComponent: React.FC<UserEditDialogComponentProps> = (
132134 }
133135
134136 startTransition ( async ( ) => {
135- await userService . usersUpdate ( payload ) . then ( payload => {
136- if ( payload ?. user && ( payload ?. errors ?. length ?? 0 ) <= 0 ) {
137- toast ( { title : "Updated user" , color : "success" } )
138- }
139- } )
137+ // usersUpdate may require a fresh MFA confirmation. withMfa shows the step-up
138+ // dialog and retries with the mfa merged into the payload.
139+ const result = await withMfa ( ( mfa ) => userService . usersUpdate ( { ...payload , ...( mfa ? { mfa} : { } ) } ) )
140+ if ( result ?. user && ( result ?. errors ?. length ?? 0 ) <= 0 ) {
141+ toast ( { title : "Updated user" , color : "success" } )
142+ }
140143 } )
141144 }
142145 } )
0 commit comments