ldap: ensure missing ldap user is auto-created

This commit is contained in:
Girish Ramakrishnan 2022-06-12 08:31:16 -07:00
parent 83ec0b5201
commit 538f3d6bd8

View file

@ -51,7 +51,7 @@ class LoginController extends AuthController
$password = param($request, 'password');
$user = $this->database->query('SELECT `id`, `email`, `username`, `password`,`is_admin`, `active`, `current_disk_quota`, `max_disk_quota`, `ldap`, `copy_raw` FROM `users` WHERE `username` = ? OR `email` = ? LIMIT 1', [$username, $username])->fetch();
if ($this->config['ldap']['enabled'] && ($user->ldap ?? true)) {
if ($this->config['ldap']['enabled'] && (!$user || $user->ldap ?? true)) {
$user = $this->ldapLogin($request, $username, param($request, 'password'), $user);
}