Laravel更新密码验证

时间:2017-07-28 12:22:14

标签: php jquery laravel laravel-5.2

我有一个编辑表格,用户将输入他的新密码,我想检查输入的密码是否与数据库中已存在的密码匹配,如果匹配则表示错误"新密码不能与旧密码相同密码"

这是我试过的代码,它对我不起作用!! :(

if(\Hash::check($request->password,$old_password)){
    return Redirect::back()->withErrors(['message', 'New Password cannot be same as old password']);
}

2 个答案:

答案 0 :(得分:0)

q)pt:{0+':x,0}
q)4 pt\ 1
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

答案 1 :(得分:0)

我想你可以尝试这个例子:

if(!Hash::check($input['current_password'], $user->password)){

   dd('Return error with current passowrd is not match.');

}else{

   dd('Write here your update password code');

}

希望这个例子适合你!!!