Ejemplo n.º 1
0
 public static function beforeLogin($username, $password)
 {
     $ldapPeopleDN = self::getPeopleDn($username);
     if (empty($ldapPeopleDN)) {
         GO::debug("LDAPAUTH: Inactive because ldap_peopledn is not set");
         return true;
     }
     GO::debug("LDAPAUTH: Active");
     try {
         return \GO\Base\Model\User::sudo(function () use($username, $password) {
             $lh = new Authenticator();
             return $lh->authenticate($username, $password);
         });
     } catch (Exception $e) {
         //When LDAP binding fail continue with GroupOffice Login
         return isset(GO::config()->ldap_login_on_exception) ? GO::config()->ldap_login_on_exception : true;
     }
 }