mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 14:42:17 +00:00
org discovery on register
This commit is contained in:
@@ -117,6 +117,7 @@ export async function POST(request: NextRequest) {
|
||||
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);
|
||||
orgToRegisterOn =
|
||||
orgs.result && orgs.result.length === 1
|
||||
|
||||
@@ -295,7 +295,16 @@ export async function listUsers({
|
||||
|
||||
export async function getOrgsByDomainSuffix(domain: string) {
|
||||
return orgService.listOrganizations(
|
||||
{ queries: [{ query: { case: "domainQuery", value: { domain } } }] },
|
||||
{
|
||||
queries: [
|
||||
{
|
||||
query: {
|
||||
case: "domainQuery",
|
||||
value: { domain, method: TextQueryMethod.EQUALS },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user