我只是在我的应用中重置了密码。所以,如果user
可用email,phone
user
,我token
reset_password
检查token
可用性{1}}作为回应。但是当我检查reset_password
表令牌和response
令牌时,两者都不同。如何检查和验证请求令牌和存储的令牌。
注意:在邮递员中测试
$api->post('confirmuser', 'App\\Api\\V1\\Controllers\\Auth\\ForgotPasswordController@confirmUser');
以下是我的controller
代码email
和phone
i验证,如果用户数据在user
表插入令牌和电子邮件reset_password
表上可用并返回以回应
public function confirmUser(Request $request)
{
$validator = Validator::make($request->all(), User::confirmUserRules());
$user = User::leftjoin('user_details','users.id', '=', 'user_details.user_id')
->where('user_details.phone', '=', $request->post('phone'))
->where('users.email', '=', $request->post('email'))
->first();
if(!$user) {
return response()->json([
'message' => "Email and phone number not match",
'status_code' => 404,
]);
}
// Here entry in reset_password table
$passwordBroker = $this->getPasswordBroker();
$tokens = $passwordBroker->getRepository();
$token = $tokens->create($user);
return response()->json([
'message' => "Your account is eligible for change password.!!",
'token' => $token,
'status_code' => 200
]);
}
这是我的回复:
{
"message": "Your account is eligible for change password.!!",
"token": "49f0b98b0a2361bb094df9191fc87ec698463da9b9cad5d6d3b4284ae69368e4",
"status_code": 200
}
现在我要验证reset_password
令牌和user
获取令牌。我怎么验证?两者都不同。