I would overwrite the postReset function inside the PasswordController since I guess your're using the trait ResetsPasswords.
public function postReset(Request $request)
{
$this->validate($request, [
'token' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed',
]);
$credentials = $request->only(
'email', 'password', 'password_confirmation', 'token'
);
$response = $this->passwords->reset($credentials, function($user, $password)
{
$user->password = bcrypt($password);
$user->save();
$token = \JWTAuth::fromUser($user);
return \Response::json(compact('token'));
});
switch ($response)
{
case PasswordBroker::PASSWORD_RESET:
return redirect($this->redirectPath());
default:
return redirect()->back()
->withInput($request->only('email'))
->withErrors(['email' => trans($response)]);
}
}
I'm confused about this part: return \Response::json(compact('token')); Are you going to return the token to the front end application? Why not let Laravel to send an email?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community