middleware('guest'); } /** * Display the form to request a password reset link. * * @return \Illuminate\View\View */ public function showLinkRequestForm() { // Redirect to home page with forgot_password modal flag return redirect()->route('home')->with('status', 'Silahkan masukkan email Anda untuk mereset password.'); } /** * Send a reset link to the given user. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse */ public function sendResetLinkEmail(Request $request) { $this->validateEmail($request); // 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($request, $response) : $this->sendResetLinkFailedResponse($request, $response); } /** * Get the response for a successful password reset link. * * @param \Illuminate\Http\Request $request * @param string $response * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse */ protected function sendResetLinkResponse(Request $request, $response) { // Return to home page with success message and keep the forgot_password modal open return redirect()->route('home') ->with('status', trans($response)) ->with('success', 'Link reset password telah dikirim ke email Anda.'); } /** * Get the response for a failed password reset link. * * @param \Illuminate\Http\Request $request * @param string $response * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse */ protected function sendResetLinkFailedResponse(Request $request, $response) { // Return to home page with error and keep the forgot_password modal open return redirect()->route('home') ->withInput($request->only('email')) ->with('error', trans($response)) ->with('status', 'Terjadi kesalahan. Silakan coba lagi.'); } }