Skip to content

Commit

Permalink
Users with password set to null need LDAP auth
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-peugnet committed Oct 29, 2024
1 parent d3884a8 commit c47e1ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/class/Controllerconnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
11 changes: 10 additions & 1 deletion app/class/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit c47e1ad

Please sign in to comment.