我正在使用 laravel auth 并通过 DB seeding 插入管理员用户,我也有加密密码,对于“remember_token”我还没有碰过它。在 DB(postgre) 中,用户添加了加密密码和空白 remember_token,但是当我尝试登录时,它显示“这些凭据与我们的记录不匹配”。
如果我注册并从注册和登录页面登录,它工作得很好。
这是我在播种机中的 run()->
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(),
) );
}
最佳答案
我建议您在用户模型中定义您的密码加密。
/**
* setPasswordAttribute
* @param void
*/
public function setPasswordAttribute($value)
{
$this->attributes['password'] = bcrypt($value);
}
关于postgresql - 这些凭据与我们的记录不符,laravel 5.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39546773/