Merge pull request #35 from Linegod/patch-1

Fix issue #28 - Grav username defaults to the LDAP users full DN
This commit is contained in:
Andy Miller
2025-11-23 17:58:09 +00:00
committed by GitHub

View File

@@ -131,7 +131,7 @@ class LoginLDAPPlugin extends Plugin
$ldap->bind($username, $credentials['password']); $ldap->bind($username, $credentials['password']);
// Create Grav User // Create Grav User
$grav_user = User::load(strtolower($username)); $grav_user = User::load(strtolower($credentials['username']));
// Set defaults with only thing we know... username provided // Set defaults with only thing we know... username provided
$grav_user['login'] = $credentials['username']; $grav_user['login'] = $credentials['username'];
@@ -258,7 +258,7 @@ class LoginLDAPPlugin extends Plugin
$this->grav['log']->error('plugin.login-ldap: ['. $e->getCode() . '] ' . $username . ' - ' . $message); $this->grav['log']->error('plugin.login-ldap: ['. $e->getCode() . '] ' . $username . ' - ' . $message);
// Just return so other authenticators can take a shot... // Just return so other authenticators can take a shot...
if ($message = "Invalid credentials") { if ($message == "Invalid credentials") {
return; return;
} }