title: Laravel 5.8 - The credentials do not match our records / attemptLogin function return always false
body: <p>I'm trying to implements authentication system with Laravel 5.8 version.
  I have run <code>php artisan make:auth</code> and made some litlle changes in the code to adapt with what i need.</p>
  <p>I have created users with my Eloquent Model, with hashed password created with the <code>Illuminate\Support\Facades\Hash</code> class.</p>
  <p>But right now i can't authenticate myself on my own application and i don't understand why i have everytime the error <code>These credentials do not match our records</code>.</p>
  <p>So here is my model <code>App\User</code> :</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  use LdapRecord\Laravel\Auth\HasLdapUser;
  use Illuminate\Notifications\Notifiable;
  use Illuminate\Foundation\Auth\User as Authenticatable;
  use LdapRecord\Laravel\Auth\AuthenticatesWithLdap;
  use LdapRecord\Laravel\Auth\LdapAuthenticatable;
  
  /**
   * Class User
   * 
   * @property int $ID_USER
   * @property string $LASTNAME
   * @property string $FIRSTNAME
   * @property string $ACTIVE_DIRECTORY_USER
   * @property int $ID_ROLE
   * @property string $password
   * @property Role $role
   *
   * @package App\Models
   */
  class User extends Authenticatable 
  {
  
      use Notifiable;
      
      /**
       * The object classes of the LDAP model.
       *
       * @var array
       */
      public static $objectClasses = [];
      protected $table = 'users';
      protected $primaryKey = 'ID_USER';
      public $incrementing = false;
      public $timestamps = false;
  
      protected $casts = [
          'ID_USER' =&gt; 'int',
          'ID_ROLE' =&gt; 'int'
      ];
  
      protected $fillable = [
          'ID_USER',
          'LASTNAME',
          'FIRSTNAME',
          'ACTIVE_DIRECTORY_USER',
          'ID_ROLE',
          'password'
      ];
  
      public function role()
      {
          return $this-&gt;belongsTo(Role::class, 'ID_ROLE');
      }
  }
  
  </code></pre>
  <p>Auth configuration :</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  return [
  
      /*
      |--------------------------------------------------------------------------
      | Authentication Defaults
      |--------------------------------------------------------------------------
      |
      | This option controls the default authentication &quot;guard&quot; and password
      | reset options for your application. You may change these defaults
      | as required, but they're a perfect start for most applications.
      |
      */
  
      'defaults' =&gt; [
          'guard' =&gt; 'web',
          'passwords' =&gt; 'users',
      ],
  
      /*
      |--------------------------------------------------------------------------
      | Authentication Guards
      |--------------------------------------------------------------------------
      |
      | Next, you may define every authentication guard for your application.
      | Of course, a great default configuration has been defined for you
      | here which uses session storage and the Eloquent user provider.
      |
      | All authentication drivers have a user provider. This defines how the
      | users are actually retrieved out of your database or other storage
      | mechanisms used by this application to persist your user's data.
      |
      | Supported: &quot;session&quot;, &quot;token&quot;
      |
      */
  
      'guards' =&gt; [
          // 'web' =&gt; [
          //     'driver' =&gt; 'session',
          //     'provider' =&gt; 'ldap',
          // ],
          'web' =&gt; [
              'driver' =&gt; 'session',
              'provider' =&gt; 'users'
          ],
          'api' =&gt; [
              'driver' =&gt; 'token',
              'provider' =&gt; 'users',
          ],
      ],
  
      /*
      |--------------------------------------------------------------------------
      | User Providers
      |--------------------------------------------------------------------------
      |
      | All authentication drivers have a user provider. This defines how the
      | users are actually retrieved out of your database or other storage
      | mechanisms used by this application to persist your user's data.
      |
      | If you have multiple user tables or models you may configure multiple
      | sources which represent each model / table. These sources may then
      | be assigned to any extra authentication guards you have defined.
      |
      | Supported: &quot;database&quot;, &quot;eloquent&quot;
      |
      */
  
      'providers' =&gt; [
          'users' =&gt; [
              'driver' =&gt; 'eloquent',
              'model' =&gt; App\User::class,
          ],
      ],
  
      /*
      |--------------------------------------------------------------------------
      | Resetting Passwords
      |--------------------------------------------------------------------------
      |
      | You may specify multiple password reset configurations if you have more
      | than one user table or model in the application and you want to have
      | separate password reset settings based on the specific user types.
      |
      | The expire time is the number of minutes that the reset token should be
      | considered valid. This security feature keeps tokens short-lived so
      | they have less time to be guessed. You may change this as needed.
      |
      */
  
      'passwords' =&gt; [
          'users' =&gt; [
              'provider' =&gt; 'users',
              'table' =&gt; 'password_resets',
              'expire' =&gt; 60,
          ],
      ],
  
  ];
  </code></pre>
  <p>The LoginController :</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  &lt;?php
  
  namespace App\Http\Controllers\Auth;
  
  use App\Http\Controllers\Controller;
  use Illuminate\Foundation\Auth\AuthenticatesUsers;
  use LdapRecord\Container;
  use Illuminate\Support\Facades\Hash;
  use Illuminate\Http\Request;
  use App\User;
  
  class LoginController extends Controller
  {
      /*
      |--------------------------------------------------------------------------
      | Login Controller
      |--------------------------------------------------------------------------
      |
      | This controller handles authenticating users for the application and
      | redirecting them to your home screen. The controller uses a trait
      | to conveniently provide its functionality to your applications.
      |
      */
      use AuthenticatesUsers;
  
      /**
       * Where to redirect users after login.
       *
       * @var string
       */
      protected $redirectTo = '/home';
  
      /**
       * Create a new controller instance.
       *
       * @return void
       */
      public function __construct()
      {
          $this-&gt;middleware('guest')-&gt;except('logout');
      }
  
      /**
       * Get the login username to be used by the controller.
       */
      public function username() {
          return 'ACTIVE_DIRECTORY_USER';
      }
  }
  
  </code></pre>
  <p>The form from the view :</p>
  <pre class="lang-php prettyprint-override"><code>&lt;form method=&quot;POST&quot; action=&quot;{{ route('login') }}&quot;&gt;
                          @csrf
  
                          &lt;div class=&quot;form-group row&quot;&gt;
                              &lt;label for=&quot;ACTIVE_DIRECTORY_USER&quot; class=&quot;col-md-4 col-form-label text-md-right&quot;&gt;{{ __(&quot;Nom d'utilisateur&quot;) }}&lt;/label&gt;
  
                              &lt;div class=&quot;col-md-6&quot;&gt;
                                  &lt;input id=&quot;ACTIVE_DIRECTORY_USER&quot; type=&quot;text&quot; class=&quot;form-control @error('ACTIVE_DIRECTORY_USER') is-invalid @enderror&quot; name=&quot;ACTIVE_DIRECTORY_USER&quot; value=&quot;{{ old('ACTIVE_DIRECTORY_USER') }}&quot; required autocomplete=&quot;ACTIVE_DIRECTORY_USER&quot; autofocus&gt;
  
                                  @error('ACTIVE_DIRECTORY_USER')
                                      &lt;span class=&quot;invalid-feedback&quot; role=&quot;alert&quot;&gt;
                                          &lt;strong&gt;{{ $message }}&lt;/strong&gt;
                                      &lt;/span&gt;
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class=&quot;form-group row&quot;&gt;
                              &lt;label for=&quot;password&quot; class=&quot;col-md-4 col-form-label text-md-right&quot;&gt;{{ __('Mot de passe') }}&lt;/label&gt;
  
                              &lt;div class=&quot;col-md-6&quot;&gt;
                                  &lt;input id=&quot;password&quot; type=&quot;password&quot; class=&quot;form-control @error('password') is-invalid @enderror&quot; name=&quot;password&quot; required autocomplete=&quot;current-password&quot;&gt;
  
                                  @error('password')
                                      &lt;span class=&quot;invalid-feedback&quot; role=&quot;alert&quot;&gt;
                                          &lt;strong&gt;{{ $message }}&lt;/strong&gt;
                                      &lt;/span&gt;
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class=&quot;form-group row&quot;&gt;
                              &lt;div class=&quot;col-md-6 offset-md-4&quot;&gt;
                                  &lt;div class=&quot;form-check&quot;&gt;
                                      &lt;input class=&quot;form-check-input&quot; type=&quot;checkbox&quot; name=&quot;remember&quot; id=&quot;remember&quot; {{ old('remember') ? 'checked' : '' }}&gt;
  
                                      &lt;label class=&quot;form-check-label&quot; for=&quot;remember&quot;&gt;
                                          {{ __('Se souvenir de moi') }}
                                      &lt;/label&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class=&quot;form-group row mb-0&quot;&gt;
                              &lt;div class=&quot;col-md-8 offset-md-4&quot;&gt;
                                  &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;
                                      {{ __('Connexion') }}
                                  &lt;/button&gt;
  
                                  @if (Route::has('password.request'))
                                      &lt;a class=&quot;btn btn-link&quot; href=&quot;{{ route('password.request') }}&quot;&gt;
                                          {{ __('Mot de passe oublié ?') }}
                                      &lt;/a&gt;
                                  @endif
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
  </code></pre>
  <p>I have snoop a little in the <code>AuthenticatesUsers</code> trait and it seems that issue come from the <code>attemptLogin</code> function because it return false everytimes...
  Don't understand how i can fix this...</p>