这些凭证与我们的记录不匹配,laravel 5.2 [英] These credentials do not match our records, laravel 5.2

查看:396
本文介绍了这些凭证与我们的记录不匹配,laravel 5.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用laravel auth并通过数据库种子插入管理用户,我也已经加密了密码,对于"remember_token",我还没有碰过.在DB(postgre)中,为用户添加了加密密码和空白的Remember_token,但是当我尝试登录时,它显示这些凭据与我们的记录不匹配".

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.

这是我在seeder->中的run()

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);
}

这篇关于这些凭证与我们的记录不匹配,laravel 5.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆