Add minor improvements to Github SSO users added to default organization on signup

This commit is contained in:
carlosmonastyrski
2025-05-02 08:22:47 -03:00
parent 63279280fd
commit 365b4b975e
2 changed files with 6 additions and 3 deletions

View File

@@ -50,8 +50,7 @@ export const SecretNameSchema = BaseSecretNameSchema.refine(
.refine((el) => !el.includes("/"), "Secret name cannot contain forward slash.");
const DefaultOrgSchema = z.object({
useDefaultOrg: z.literal(true),
organizationName: z.string().trim().optional()
useDefaultOrg: z.literal(true)
});
const CustomOrgSchema = z.object({

View File

@@ -727,7 +727,11 @@ export const authLoginServiceFactory = ({
if (authMethod === AuthMethod.GITHUB && serverCfg.defaultAuthOrgId) {
let orgId = "";
const defaultOrg = await orgDAL.findOrgById(serverCfg.defaultAuthOrgId);
if (!defaultOrg) throw new BadRequestError({ message: "Failed to find default organization" });
if (!defaultOrg) {
throw new BadRequestError({
message: `Failed to find default organization with ID ${serverCfg.defaultAuthOrgId}`
});
}
orgId = defaultOrg.id;
const [orgMembership] = await orgDAL.findMembership({
[`${TableName.OrgMembership}.userId` as "userId"]: user.id,