I have this code:
$.ajax({
url:"/password/email",
data: {
_token: $(".modal-forgotpass-content input[name='_token']").val(),
email: $(".modal-forgotpass-content input[name='email']").val()
},
type: "POST",
success: function(data) {
alert("Successful : link send");
},
error: function(e) {
alert("Faild: link not send");
}
Controller (this function is coming with laravel 5.4) :
public function sendResetLinkEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$response = $this->broker()->sendResetLink(
$request->only('email')
);
return $response == Password::RESET_LINK_SENT
? $this->sendResetLinkResponse($response)
: $this->sendResetLinkFailedResponse($request, $response);
}
Routes :
Auth::routes();
this code its work well ,but he send password reset link to all emails even if the email not exist in database(users table) i want the link to be sent only to the emails already exist in user table any help? Thank you
via Ilham Guezzoula