我有一个系统,其中几个Laravel应用程序上传信息到个人数据库,这些数据库的信息可以通过一个通用的Laravel访问,这是该系统的核心。我使用散列::在我的Laravel应用程序中散列我的密码,但是我想在我的Laravel中检查它们,但是当我尝试\散列::检查密码不匹配时。
这是我在Laravel应用程序中的哈希码:
$patient = new patient();
$patient->username = $request->input('username');
$patient->password = \Hash::make($request->input('password'));
$patient->fullname = $request->input('name');
$patient->note = $request->input('note');
$patient->save();这是我的API登录代码:
$username = $request->username;
$password = $request->password;
$patient = Patients::where('username','=',$username)->get();
if (\Hash::check($password, $patient[0]->password))
{
return response()->json($patient[count($patient)-1]);
}else {
return 0;
} 我是做错了什么还是不能做那样的事?
谢谢:)
我使用的是Laravel5.8
发布于 2020-01-20 17:55:17
我的猜测是,您的config/hashing.php可能在这些应用程序之间配置不同。有多种选择(例如Bcrypt、Argon2i、Argon2id等.)对于此配置,以及在存储散列密码时使用哪种配置,在检查该配置时将非常重要。确保它们在不同的应用中是一致的。
https://stackoverflow.com/questions/59828556
复制相似问题