/** * Send a confirmation link to the given user. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function sendConfirmationLink(Request $request) { $this->validate($request, ['email' => 'required|email']); $response = Confirmation::sendConfirmationLink($request->only('email'), function (Message $message) { $message->subject($this->getEmailSubject()); }); switch ($response) { case Confirmation::CONFIRMATION_LINK_SENT: return redirect($this->loginPath())->with('status', trans($response)); case Confirmation::INVALID_TOKEN: return redirect()->back()->withErrors(['email' => trans($response)]); } }
/** * Display the password reset view for the given token. * * @param string $token * @return \Illuminate\Http\Response */ public function getConfirm($token = null) { if (is_null($token)) { throw new NotFoundHttpException(); } $credentials = ['token' => $token]; $response = Confirmation::confirm($credentials, function ($user) { $this->confirmAccount($user); }); switch ($response) { case Confirmation::ACCOUNT_CONFIRMATION: return redirect($this->redirectPath())->with('status', trans($response)); default: return redirect()->back()->withErrors(['email' => trans($response)]); } }
/** * Display the password reset view for the given token. * * @param string $token * @return \Illuminate\Http\Response */ public function getConfirm($token = null) { if (is_null($token)) { return responseJsonNotFound(['message' => trans(Confirmation::NULL_TOKEN), 'errors' => trans(Confirmation::NULL_TOKEN)]); } $credentials = ['token' => $token]; $response = Confirmation::confirm($credentials, function ($user) { $this->confirmAccount($user); }); switch ($response) { case Confirmation::ACCOUNT_CONFIRMATION: return responseJsonOk(['message' => trans($response), 'data' => null]); default: return responseJsonUnprocessableEntity(['message' => trans($response), 'errors' => ['email' => trans($response)]]); } }