我正在处理 Laravel 5.6。我正在使用 JWT 身份验证,并且我创建了自己的身份验证控制器。
这是我在 AuthController 的恢复方法,
public function recover(Request $request)
{
$user = User::where('email', $request->email)->first();
if (!$user) {
$error_message = "Your email address was not found.";
return response()->json(['success' => false, 'error' => ['email'=> $error_message]], 401);
}
try {
Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject('Your Password Reset Link');
});
} catch (\Exception $e) {
$error_message = $e->getMessage();
return response()->json(['success' => false, 'error' => $error_message], 401);
}
return response()->json([
'success' => true, 'data'=> ['message'=> 'A reset email has been sent! Please check your email.']
]);
}
在邮递员中,如果我执行恢复方法,我会收到此消息
{
"success": false,
"error": "Route [password.reset] not defined."
}
我该如何处理。谢谢!