3 namespace BookStack\Http\Controllers\Auth;
5 use BookStack\Http\Controllers\Controller;
6 use Illuminate\Foundation\Auth\ResetsPasswords;
7 use Illuminate\Http\Request;
8 use Illuminate\Support\Facades\Password;
10 class ResetPasswordController extends Controller
13 |--------------------------------------------------------------------------
14 | Password Reset Controller
15 |--------------------------------------------------------------------------
17 | This controller is responsible for handling password reset requests
18 | and uses a simple trait to include this behavior. You're free to
19 | explore this trait and override any methods you wish to tweak.
25 protected $redirectTo = '/';
28 * Create a new controller instance.
32 public function __construct()
34 $this->middleware('guest');
35 $this->middleware('guard:standard');
36 parent::__construct();
40 * Get the response for a successful password reset.
42 * @param Request $request
43 * @param string $response
44 * @return \Illuminate\Http\Response
46 protected function sendResetResponse(Request $request, $response)
48 $message = trans('auth.reset_password_success');
49 $this->showSuccessNotification($message);
50 return redirect($this->redirectPath())
51 ->with('status', trans($response));
55 * Get the response for a failed password reset.
57 * @param \Illuminate\Http\Request $request
58 * @param string $response
59 * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
61 protected function sendResetFailedResponse(Request $request, $response)
63 // We show invalid users as invalid tokens as to not leak what
64 // users may exist in the system.
65 if ($response === Password::INVALID_USER) {
66 $response = Password::INVALID_TOKEN;
69 return redirect()->back()
70 ->withInput($request->only('email'))
71 ->withErrors(['email' => trans($response)]);