Php 拉威尔·奥特不记得我了

Php 拉威尔·奥特不记得我了,php,laravel,cookies,laravel-5.2,remember-me,Php,Laravel,Cookies,Laravel 5.2,Remember Me,我好像不能去上班了 以下是我正在尝试的: 如果我选中登录页面上的“记住我”复选框,然后登录,我的数据库中的membered\u token列将被填写 然后,我使用Chrome删除laravel\u会话cookie以模拟即将到期的会话 我在我的网页上点击了另一个链接,我马上就被注销了 我希望Laravel使用这个记住我\u XXX令牌让我重新登录,但这并没有发生 我不确定在哪里调试这个。据推测,它是由“auth”中间件处理的,但这只会带我穿过一条兔子的足迹。搜索“记住web”会显示0个结果,所以我

我好像不能去上班了

以下是我正在尝试的:

  • 如果我选中登录页面上的“记住我”复选框,然后登录,我的数据库中的
    membered\u token
    列将被填写
  • 然后,我使用Chrome删除
    laravel\u会话
    cookie以模拟即将到期的会话
  • 我在我的网页上点击了另一个链接,我马上就被注销了
  • 我希望Laravel使用这个
    记住我\u XXX
    令牌让我重新登录,但这并没有发生

    我不确定在哪里调试这个。据推测,它是由“auth”中间件处理的,但这只会带我穿过一条兔子的足迹。搜索“记住web”会显示0个结果,所以我甚至不知道cookie是从哪里来的

    所以我的问题是,

  • 我必须做什么/实施什么才能让Laravel使用“记住我”令牌让我重新登录
  • 或者,在Laravel的源代码中,这个cookie是在哪里读取和使用的,这样我就可以调试它了

  • 设法找到了问题所在。实际上,我在我的
    User
    类中错误地实现了
    \illumb\Contracts\Auth\authenticable
    接口

    我曾经这样做过:

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword()
    {
        return $this->password;
    }
    
    /**
     * Get the e-mail address where password reminders are sent.
     *
     * @return string
     */
    public function getReminderEmail()
    {
        return $this->email;
    }
    
    /**
     * Get the token value for the "remember me" session.
     *
     * @return string
     */
    public function getRememberToken() {
        return $this->remember_token;
    }
    
    /**
     * Set the token value for the "remember me" session.
     *
     * @param  string $value
     * @return void
     */
    public function setRememberToken($value) {
        $this->remember_token = $value;
    }
    
    当我应该这样做的时候:

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword() {
        return $this->getAttribute('password');
    }
    
    /**
     * Get the e-mail address where password reminders are sent.
     *
     * @return string
     */
    public function getReminderEmail() {
        return $this->getAttribute('email');
    }
    
    /**
     * Get the token value for the "remember me" session.
     *
     * @return string
     */
    public function getRememberToken() {
        return $this->getAttribute('remember_token');
    }
    

    我不确定我从哪里复制了原始代码,但基本上所有必要的数据都存储在模型属性中,而不是类实例本身,所以所有这些函数都返回了
    null
    或一个空字符串。

    我在
    \illumb\Auth\SessionGuard::user
    中发现了一些东西——现在正在调查
    \illumb\Auth\SessionGuard::validRecall
    返回false,因为memory me标记中不包含
    ,为什么不?谢谢分享这个信息!我已经调试了几个小时没有记忆了,多亏了你,我才专注于我的
    getMemberToken()
    ,发现了一个bug。