Merge commit from fork

This commit is contained in:
Max Peintner
2026-03-04 12:44:29 +01:00
committed by GitHub
parent 2763e93a61
commit 692797eafc
2 changed files with 42 additions and 8 deletions
+24 -8
View File
@@ -34,6 +34,20 @@ export async function registerUser(
const _headers = await headers();
const { serviceConfig } = getServiceConfig(_headers);
const loginSettings = await getLoginSettings({ serviceConfig, organization: command.organization });
if (!loginSettings) {
return { error: t("errors.couldNotGetLoginSettings") };
}
if (!loginSettings.allowRegister) {
return { error: t("errors.registerNotAllowed") };
}
if (command.password && !loginSettings.allowLocalAuthentication) {
return { error: t("errors.localAuthenticationNotAllowed") };
}
const addResponse = await addHumanUser({
serviceConfig,
email: command.email,
@@ -47,8 +61,6 @@ export async function registerUser(
return { error: t("errors.couldNotCreateUser") };
}
const loginSettings = await getLoginSettings({ serviceConfig, organization: command.organization });
let checkPayload: any = {
user: { search: { case: "userId", value: addResponse.userId } },
};
@@ -163,6 +175,16 @@ export async function registerUserAndLinkToIDP(
const _headers = await headers();
const { serviceConfig } = getServiceConfig(_headers);
const loginSettings = await getLoginSettings({ serviceConfig, organization: command.organization });
if (!loginSettings) {
return { error: t("errors.couldNotGetLoginSettings") };
}
if (!loginSettings.allowRegister) {
return { error: t("errors.registerNotAllowed") };
}
const addUserResponse = await addHumanUser({
serviceConfig,
email: command.email,
@@ -171,12 +193,6 @@ export async function registerUserAndLinkToIDP(
organization: command.organization,
});
if (!addUserResponse) {
return { error: t("errors.couldNotCreateUser") };
}
const loginSettings = await getLoginSettings({ serviceConfig, organization: command.organization });
const idpLink = await addIDPLink({
serviceConfig,
idp: {