我试图改变密码laravel 5.4它成功改变,但之后,当我想再次用新密码登录它引发错误凭据不匹配。更改密码不工作laravel 5.4
这里是我的代码 -
public function UpdatePassword(Request $request)
{
$this->validate($request, [
'old_password' => 'required',
'password' => 'required|string|min:6|confirmed',
]);
$old_password = $request->old_password;
if (Hash::check($old_password, Auth::user()->password)) {
# code...
Auth::user()->update(['password'=>bcrypt($request->new_password)]);
return back()->with('message','password chnaged successfully.');
} else {
# code...
return back()->with('message_error','Please Enter Correct Old Password.');
}
}
请让我知道什么是错的代码?
不应'bcrypt($ request-> new_password)]'bcrypt($ request-> password)]'? – linktoahref