小编Bip*_*ane的帖子

网站上的数据泄露暴露了 Chrome 在我的登录表单上发送的密码消息

我做了一个登录表单,一个经过身份验证的用户被重定向到他们的主页。但是,随着重定向 chrome 向我发送了这个这是chrome发送的消息

我对警告一无所知。我的代码是:

     /**
     * Go Login, login button is clicked
     * 
     * @return void
     */
    public function goLoginAction()
    {
        $user = new User($_POST);

        if ($user->verifyPassword()) {
            $user = User::findByUsername($user->username);

            Auth::login($user);

            $this->redirect("/$user->username/home/");
        } 

        $this->redirect('/');

    }
Run Code Online (Sandbox Code Playgroud)

go-login 是表单的操作。所以,$_POST 被发送到 go-login。verifyPassword 是验证密码的函数:

     /**
     * Verify password
     * 
     * @return true if password is correct, false otherwise
     */
    public function verifyPassword()
    {
        $users = static::findByUsername($this->username);
        if (password_verify($this->password, $users->password)) {
            return true;            
        }
        return false;
    }
Run Code Online (Sandbox Code Playgroud)

findByUsername 是按用户名返回对象用户的函数。并且,go-login 函数中的 Auth 类创建会话:

     /**
     * …
Run Code Online (Sandbox Code Playgroud)

php

19
推荐指数
1
解决办法
1万
查看次数

如何在字符串中添加整数?

我想在整数值后附加字符串值,而不是变量。

我试图输入一个整数值,该值是一个名为February的字符串的变量。我使用+ =运算符尝试了一下,但是没有用。

string getMonth(day)
{
      if(day >=31 ){
          day -= 31;
          "February "+=day;
      }
}
Run Code Online (Sandbox Code Playgroud)

c++ string operator-overloading concatenation operators

2
推荐指数
1
解决办法
58
查看次数