mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-13 19:09:16 +00:00
fix: use default org if no context detected
This commit is contained in:
@@ -4,7 +4,6 @@ import { linkingFailed } from "@/components/idps/pages/linking-failed";
|
|||||||
import { linkingSuccess } from "@/components/idps/pages/linking-success";
|
import { linkingSuccess } from "@/components/idps/pages/linking-success";
|
||||||
import { loginFailed } from "@/components/idps/pages/login-failed";
|
import { loginFailed } from "@/components/idps/pages/login-failed";
|
||||||
import { loginSuccess } from "@/components/idps/pages/login-success";
|
import { loginSuccess } from "@/components/idps/pages/login-success";
|
||||||
import { idpTypeToIdentityProviderType } from "@/lib/idp";
|
|
||||||
import { getServiceUrlFromHeaders } from "@/lib/service";
|
import { getServiceUrlFromHeaders } from "@/lib/service";
|
||||||
import {
|
import {
|
||||||
addHuman,
|
addHuman,
|
||||||
@@ -19,7 +18,10 @@ import {
|
|||||||
import { create } from "@zitadel/client";
|
import { create } from "@zitadel/client";
|
||||||
import { AutoLinkingOption } from "@zitadel/proto/zitadel/idp/v2/idp_pb";
|
import { AutoLinkingOption } from "@zitadel/proto/zitadel/idp/v2/idp_pb";
|
||||||
import { OrganizationSchema } from "@zitadel/proto/zitadel/object/v2/object_pb";
|
import { OrganizationSchema } from "@zitadel/proto/zitadel/object/v2/object_pb";
|
||||||
import { AddHumanUserRequestSchema } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
|
import {
|
||||||
|
AddHumanUserRequest,
|
||||||
|
AddHumanUserRequestSchema,
|
||||||
|
} from "@zitadel/proto/zitadel/user/v2/user_service_pb";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
import { getLocale, getTranslations } from "next-intl/server";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
@@ -83,8 +85,6 @@ export default async function Page(props: {
|
|||||||
throw new Error("IDP not found");
|
throw new Error("IDP not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
const providerType = idpTypeToIdentityProviderType(idp.type);
|
|
||||||
|
|
||||||
if (link) {
|
if (link) {
|
||||||
if (!options?.isLinkingAllowed) {
|
if (!options?.isLinkingAllowed) {
|
||||||
// linking was probably disallowed since the invitation was created
|
// linking was probably disallowed since the invitation was created
|
||||||
@@ -205,15 +205,23 @@ export default async function Page(props: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addHumanUser && orgToRegisterOn) {
|
if (addHumanUser) {
|
||||||
const organizationSchema = create(OrganizationSchema, {
|
let addHumanUserWithOrganization: AddHumanUserRequest;
|
||||||
org: { case: "orgId", value: orgToRegisterOn },
|
if (orgToRegisterOn) {
|
||||||
});
|
const organizationSchema = create(OrganizationSchema, {
|
||||||
|
org: { case: "orgId", value: orgToRegisterOn },
|
||||||
|
});
|
||||||
|
|
||||||
const addHumanUserWithOrganization = create(AddHumanUserRequestSchema, {
|
addHumanUserWithOrganization = create(AddHumanUserRequestSchema, {
|
||||||
...addHumanUser,
|
...addHumanUser,
|
||||||
organization: organizationSchema,
|
organization: organizationSchema,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
addHumanUserWithOrganization = create(
|
||||||
|
AddHumanUserRequestSchema,
|
||||||
|
addHumanUser,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
newUser = await addHuman({
|
newUser = await addHuman({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
|
Reference in New Issue
Block a user