首页 文章

这些凭据与我们的记录laravel 5.3不符

提问于
浏览
0

What i want

我想使用通过 php artisan make:auth 命令获得的laravel认证系统


what happened

  • 我可以看到注册表单注册的项目,但我无法使用这些凭据通过应用程序登录 .

  • 错误:这些凭据与我们的记录不匹配 .

What i did

php artisan make:Auth

user.php的

namespace App;

use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Auth\Authenticatable as AuthenticatableTrait;

use Illuminate\Database\Eloquent\Model;
class User extends Model implements Authenticatable 
{
    protected $fillable=['name','password','email'];
    protected $table='blog_users';


    public function getAuthIdentifierName(){}
    public function getAuthIdentifier(){}
    public function getAuthPassword(){}
    public function getRememberToken(){}
    public function setRememberToken($value){}
    public function getRememberTokenName(){}
}

What i tried

我试图提供我的操作方法,但我仍然无法通过这些凭据登录,我仍然看到相同的错误 .


What i hope

为了更好地了解我的问题及其解决方案?


Snapshots

enter image description here

enter image description here

2 回答

  • 0

    这就是我的Laravel 5.3用户模型的样子:

    <?php
    
    namespace App;
    
    use Illuminate\Notifications\Notifiable;
    use Illuminate\Foundation\Auth\User as Authenticatable;
    
    class User extends Authenticatable
    {
        use Notifiable;
    
        /**
         * The attributes that are mass assignable.
         *
         * @var array
         */
        protected $fillable = [
            'name', 'email', 'password',
        ];
    
        /**
         * The attributes that should be hidden for arrays.
         *
         * @var array
         */
        protected $hidden = [
            'password', 'remember_token',
        ];
    }
    

    我会假设所有这些空方法都会给你带来麻烦 .

  • 1

    Laravel比较Hased密码:

    为此,您需要以下列任一方式存储密码:

    $password = bcrypt('secret');
    

    要么

    $password = Hash::make('secret');
    

    为了更好地理解这一点: - https://laravel.com/docs/5.0/hashing

    希望这对你有所帮助 .

相关问题