Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: check ldap success from response

Scott Wilson0b5e6d0023a3
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx
index 6c75776878..44c79e4f42 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx
@@ -171,17 +171,33 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
};
const handleTestLDAPConnection = async () => {
- await testLDAPConnection({
- url: watchUrl,
- bindDN: watchBindDN,
- bindPass: watchBindPass,
- caCert: watchCaCert ?? ""
- });
+ try {
+ const isConnected = await testLDAPConnection({
+ url: watchUrl,
+ bindDN: watchBindDN,
+ bindPass: watchBindPass,
+ caCert: watchCaCert ?? ""
+ });
- createNotification({
- text: "Successfully tested the LDAP connection: Bind operation was successful",
- type: "success"
- });
+ if (isConnected) {
+ createNotification({
+ text: "Successfully tested the LDAP connection: Bind operation was successful",
+ type: "success"
+ });
+ } else {
+ createNotification({
+ text: "Failed to connect to the LDAP server. Verify the URL, bind DN/password, and CA certificate.",
+ type: "error"
+ });
+ }
+ } catch (err) {
+ createNotification({
+ text:
+ (err as { response?: { data?: { message?: string } } })?.response?.data?.message ??
+ "Failed to test LDAP connection.",
+ type: "error"
+ });
+ }
};
const isPending = createIsLoading || updateIsLoading;