/** * Send a reset link to the given user. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function sendResetLinkEmail(Request $request, AppMailer $mailer) { $this->validate($request, ['email' => 'required|email']); $email = $request->input('email'); // Check if the given user exists $userNode = $this->users->getUser($email); if (empty($userNode)) { return redirect()->back()->withErrors(['email' => 'Het email adres werd niet gevonden.']); } $person = new Person(); $person->setNode($userNode); $person->setPasswordResetToken($this->getToken()); // Send the reset link to the user $mailer->sendResetLinkEmail($person); return redirect()->back()->with('message', 'Er werd een email verstuurd, hou zeker ook uw SPAM folder in het oog.'); }