diff --git a/app/class/Controllerconnect.php b/app/class/Controllerconnect.php index ea068b28..311e2766 100644 --- a/app/class/Controllerconnect.php +++ b/app/class/Controllerconnect.php @@ -60,7 +60,7 @@ protected function login(): void return; } - if (Config::isldap()) { + if ($this->user->isldap()) { // use ldap for password try { $ldap = new Modelldap(Config::ldapserver(), Config::ldaptree(), Config::ldapu()); diff --git a/app/class/User.php b/app/class/User.php index 0d6e3d6a..dfe78638 100644 --- a/app/class/User.php +++ b/app/class/User.php @@ -11,7 +11,7 @@ class User extends Item protected string $id = ''; protected int $level = 0; protected string $signature = ''; - protected ?string $password; + protected ?string $password = null; protected bool $passwordhashed = false; /** @var string $name Displayed name */ @@ -63,6 +63,15 @@ public function __construct($datas = []) $this->hydrate($datas); } + /** + * Indicate if User is authenticated using LDAP. + * It is if password is set to null. + */ + public function isldap(): bool + { + return (is_null($this->password)); + } + // _________________________ G E T _______________________ public function id()