mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 08:32:39 +00:00
replace mgmt service request
This commit is contained in:
@@ -2,7 +2,7 @@ import { idpTypeToSlug } from "@/lib/idp";
|
||||
import {
|
||||
getActiveIdentityProviders,
|
||||
getLoginSettings,
|
||||
getOrgsByDomainSuffix,
|
||||
getOrgsByDomain,
|
||||
listAuthenticationMethodTypes,
|
||||
listUsers,
|
||||
startIdentityProviderFlow,
|
||||
@@ -112,13 +112,14 @@ export async function POST(request: NextRequest) {
|
||||
if (
|
||||
!orgToRegisterOn &&
|
||||
loginName &&
|
||||
ORG_SUFFIX_REGEX.test(loginName)
|
||||
ORG_SUFFIX_REGEX.test(loginName) &&
|
||||
loginSettings.allowDomainDiscovery
|
||||
) {
|
||||
const matched = ORG_SUFFIX_REGEX.exec(loginName);
|
||||
const suffix = matched?.[1] ?? "";
|
||||
|
||||
// this just returns orgs where the suffix is set as primary domain
|
||||
const orgs = await getOrgsByDomainSuffix(suffix);
|
||||
const orgs = await getOrgsByDomain(suffix);
|
||||
orgToRegisterOn =
|
||||
orgs.result && orgs.result.length === 1
|
||||
? orgs.result[0].id
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
createCallback,
|
||||
getActiveIdentityProviders,
|
||||
getAuthRequest,
|
||||
getOrgByDomain,
|
||||
getOrgsByDomain,
|
||||
listSessions,
|
||||
startIdentityProviderFlow,
|
||||
} from "@/lib/zitadel";
|
||||
@@ -147,8 +147,10 @@ export async function GET(request: NextRequest) {
|
||||
const matched = ORG_DOMAIN_SCOPE_REGEX.exec(orgDomainScope);
|
||||
const orgDomain = matched?.[1] ?? "";
|
||||
if (orgDomain) {
|
||||
const org = await getOrgByDomain(orgDomain);
|
||||
organization = org?.org?.id ?? "";
|
||||
const orgs = await getOrgsByDomain(orgDomain);
|
||||
if (orgs.result && orgs.result.length === 1) {
|
||||
organization = orgs.result[0].id ?? "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ export async function listUsers({
|
||||
);
|
||||
}
|
||||
|
||||
export async function getOrgsByDomainSuffix(domain: string) {
|
||||
export async function getOrgsByDomain(domain: string) {
|
||||
return orgService.listOrganizations(
|
||||
{
|
||||
queries: [
|
||||
|
||||
Reference in New Issue
Block a user