Closed TheSoulGamer158 closed 2 years ago
Hi @TheSoulGamer158, you’ve set the database.model
config option to the same LDAP\User::class. This should instead be your Eloquent user model (either App\User::class or App\Models\User::class).
Give that a shot and it should resolve your issue 👍
I edited like you said to this:
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'ldap' => [
'driver' => 'ldap',
'model' => App\LDAP\User::class,
'rules' => [],
'database' => [
'model' => App\Models\User::class,
'sync_passwords' => true,
'sync_attributes' => [
'name' => 'cn',
'email' => 'mail',
],
],
],
Even with it I get this error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'mail' in 'where clause'
select * from
userswhere
mail= user01@ahdrive.local limit 1
If I edit the authenticate() within the LoginRequest.php like this I don't get the error but can't find a user.
public function authenticate()
{
$this->ensureIsNotRateLimited();
// $credentials = [
// 'mail' => $this->email,
// 'password' => $this->password,
// ];
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}
RateLimiter::clear($this->throttleKey());
}
Hi @TheSoulGamer158,
You've defined an ldap
guard inside of your config/auth.php
file, but are using the default web
guard. Ensure that your defaults.guard
option inside of your config/auth.php
file is set to ldap
.
Also, the credentials array should be mail
and password
. Not email
and password
(you had it correct previously).
Fixing those above issues should allow you to authenticate. Closing for now. Let me know if you encounter further issues.
Environment: LDAP Server Type: OpenLDAP LdapRecord-Laravel Major Version: v.2 PHP Version: 8.0.11
Describe the bug: Hey there me again.. Your solution yesterday worked perfectly but for now if I try to login with a user, I get this error
I'm pretty sure that my Model doesn't work as it should be, maybe a little error I can't find. Here my Ldap\User.php:
My web.php:
And my LoginRequest.php:
If I'm correct the error points to this config in my auth.php right?
Would you be so kind and help me once again? :D