【问题标题】:Cakephp 3 Auth Component $this->Auth->password() not workingCakephp 3 Auth 组件 $this->Auth->password() 不起作用
【发布时间】:2015-09-10 06:49:11
【问题描述】:

我想用 users 表更新我的密码,并且在 cakephp 2.0 中我使用的是这样 --

$haspass = $this->Auth->password($pass);

工作正常,但在 cakephp3 中它不工作..

【问题讨论】:

    标签: cakephp-3.0


    【解决方案1】:

    我终于找到了解决办法——

    在控制器中——像那样使用

    use Cake\Auth\DefaultPasswordHasher;
    use Cake\ORM\Entity;
    
    $password = $_POST['new_pswd'];
    $hashPswdObj = new DefaultPasswordHasher;
    $hashpswd = $hashPswdObj->hash($password); // it will hash the password
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-23
    • 1970-01-01
    • 2013-01-15
    • 1970-01-01
    • 2011-12-20
    • 1970-01-01
    • 2014-02-25
    相关资源
    最近更新 更多