mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 14:54:33 +00:00
clean settings fetch
This commit is contained in:
@@ -587,13 +587,11 @@ export async function setPassword(
|
||||
type CheckSessionAndSetPasswordCommand = {
|
||||
sessionId: string;
|
||||
password: string;
|
||||
forceMfa: boolean;
|
||||
};
|
||||
|
||||
export async function checkSessionAndSetPassword({
|
||||
sessionId,
|
||||
password,
|
||||
forceMfa,
|
||||
}: CheckSessionAndSetPasswordCommand) {
|
||||
const sessionCookie = await getSessionCookieById({ sessionId });
|
||||
|
||||
@@ -633,6 +631,13 @@ export async function checkSessionAndSetPassword({
|
||||
(method) => !authmethods.authMethodTypes.includes(method),
|
||||
);
|
||||
|
||||
const loginSettings = await getLoginSettings(
|
||||
session.factors.user.organizationId,
|
||||
);
|
||||
const forceMfa = !!(
|
||||
loginSettings?.forceMfa || loginSettings?.forceMfaLocalOnly
|
||||
);
|
||||
|
||||
// if the user has no MFA but MFA is enforced, we can set a password otherwise we use the token of the user
|
||||
if (forceMfa && hasNoMFAMethods) {
|
||||
return userService.setPassword(payload, {}).catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user