简体   繁体   中英

These credentials do not match our records, laravel 5.2

I am using laravel auth and inserting admin users through DB seeding, I have encrypted passwords also and for "remember_token" I have not touched it. In DB(postgre) user is added with encrypted password and blank remember_token, but when I try to login it shows "These credentials do not match our records".

If I register and do login from register and login pages, it works perfectly fine.

Here is my run() in seeder->

public function run()
{
    DB::table ( 'users' )->insert ( array (
            'name' => 'Test',
            'email' => 'test@gmail.com',
            'password'=>bcrypt('test'),
            'created_at'=>new DateTime(),
            'updated_at'=>new DateTime(),
    ) );

    DB::table ( 'users' )->insert ( array (
            'name' => 'Demo',
            'email' => 'demo@gmail.com',
            'password'=>bcrypt('demo'),
            'created_at'=>new DateTime(),
            'updated_at'=>new DateTime(),
    ) );
}

I would suggest you define in your User Model your password encryption.

/**
 * setPasswordAttribute
 * @param void
 */
public function setPasswordAttribute($value)
{
    $this->attributes['password'] = bcrypt($value);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM