diff --git a/src/Auth/Repository/LDAP.php b/src/Auth/Repository/LDAP.php index 55eadcf..80ccc80 100644 --- a/src/Auth/Repository/LDAP.php +++ b/src/Auth/Repository/LDAP.php @@ -63,10 +63,11 @@ public function getByLogin(string $login): ?Root foreach ($collection->toArray() as $entry) { $user = $this->entity($this->config('auth.entity'))->load($entry->getDn(), $this->config('auth.ldap.fields.loginInDb', 'email')); foreach ($entry->getAttributes() as $attribute => $value) { - $field = $this->config('auth.fields.map.'.$attribute); + $field = $this->config('auth.ldap.fields.map.'.$attribute); if ($field) { $user->set($field, $value[0] ?? null); } + $user->set($this->config('auth.ldap.fields.loginInDb', 'email'), $entry->getDn()); } $user->save();