From bfd275939560ce008336a00afbbd4d377ea3693f Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Tue, 27 Oct 2020 11:47:08 +0100
Subject: [PATCH] FEAT #13695 TIME 0:20 Fix ldap with malformed config

---
 src/core/controllers/AuthenticationController.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php
index d480649774e..9c142c8645d 100755
--- a/src/core/controllers/AuthenticationController.php
+++ b/src/core/controllers/AuthenticationController.php
@@ -380,7 +380,7 @@ class AuthenticationController
         $password = $args['password'];
 
         $ldapConfigurations = CoreConfigModel::getXmlLoaded(['path' => 'modules/ldap/xml/config.xml']);
-        if (empty($ldapConfigurations)) {
+        if (empty($ldapConfigurations) || empty($ldapConfigurations->config->ldap)) {
             return ['errors' => 'No ldap configurations'];
         }
 
@@ -430,7 +430,7 @@ class AuthenticationController
 
         if (empty($authenticated) && !empty($error) && $error != 'Invalid credentials') {
             return ['errors' => $error];
-        } elseif (empty($authenticated) && !empty($error) && $error == 'Invalid credentials') {
+        } elseif (empty($authenticated)) {
             return ['errors' => 'Authentication Failed'];
         }
 
-- 
GitLab