Enhance SSO Functionality: Add detailed view for SSO providers in SSOSettings, including OIDC and SAML configuration parsing. Implement loading states for SSO sign-in on the homepage and expose a public API for listing SSO providers. Update UI components for better user experience and maintainability.

This commit is contained in:
Mauricio Siu
2026-01-30 20:35:17 -06:00
parent 61f6bbfe1c
commit 3c2f675eb9
6 changed files with 293 additions and 28 deletions

View File

@@ -50,6 +50,7 @@ export const { handler, api } = betterAuth({
? [
"http://localhost:3000",
"https://absolutely-handy-falcon.ngrok-free.app",
"https://keycloak.vesperfit.com",
]
: []),
];
@@ -110,11 +111,11 @@ export const { handler, api } = betterAuth({
const isAdminPresent = await db.query.member.findFirst({
where: eq(schema.member.role, "owner"),
});
if (isAdminPresent) {
throw new APIError("BAD_REQUEST", {
message: "Admin is already created",
});
}
// if (isAdminPresent) {
// throw new APIError("BAD_REQUEST", {
// message: "Admin is already created",
// });
// }
}
}
},
@@ -154,27 +155,27 @@ export const { handler, api } = betterAuth({
}
}
if (IS_CLOUD || !isAdminPresent) {
await db.transaction(async (tx) => {
const organization = await tx
.insert(schema.organization)
.values({
name: "My Organization",
ownerId: user.id,
createdAt: new Date(),
})
.returning()
.then((res) => res[0]);
await tx.insert(schema.member).values({
userId: user.id,
organizationId: organization?.id || "",
role: "owner",
// if (IS_CLOUD || !isAdminPresent) {
await db.transaction(async (tx) => {
const organization = await tx
.insert(schema.organization)
.values({
name: "My Organization",
ownerId: user.id,
createdAt: new Date(),
isDefault: true, // Mark first organization as default
});
})
.returning()
.then((res) => res[0]);
await tx.insert(schema.member).values({
userId: user.id,
organizationId: organization?.id || "",
role: "owner",
createdAt: new Date(),
isDefault: true, // Mark first organization as default
});
}
});
// }
},
},
},