简体   繁体   English

laravel 5 哈希::检查不起作用

[英]laravel 5 Hash::check not working

I want to check whether old password which user typed is matched with DB password using check hash, but its not working correctly please advice.我想使用检查哈希检查用户输入的旧密码是否与数据库密码匹配,但它无法正常工作,请建议。

Below is my code which I used to update password function fields which required are old_passwrord, new_password.下面是我用来更新密码功能字段的代码,这些字段需要 old_passwrord、new_password。

Currently it doesn't go to hash check fucntion and directly update password.目前它不去哈希检查功能并直接更新密码。

            else if (Hash::check('password', $getPassword->password)) 
            {
                return ['error'=>['code'=>206, 'message'=>'old password is not matching']];
            }

Replace代替

else if (Hash::check('password', $getPassword->password)) 

with

else if ( ! Hash::check('password', $getPassword->password)) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM