/** * Handle a POST request to reset a user's password. * * @return Response */ public function postReset() { $credentials = Input::only('email', 'password', 'password_confirmation', 'token'); // validate $val = $this->userRepository->getPasswordResetForm(); // check if the form is valid if (!$val->isValid()) { return Redirect::back()->with('errors', $val->getErrors())->withInput(); } $response = $this->service->resetPassword($credentials); switch ($response) { case Password::INVALID_PASSWORD: return Redirect::back()->with('error', Lang::get('auth.alerts.wrong_password_reset'))->withInput(); case Password::INVALID_TOKEN: return Redirect::back()->with('error', Lang::get('auth.alerts.wrong_token'))->withInput(); case Password::INVALID_USER: return Redirect::back()->with('error', Lang::get('auth.alerts.invalid_user'))->withInput(); case Password::PASSWORD_RESET: return Redirect::action('AuthController@getLogin')->with('success', trans('auth.alerts.password_resetted')); } }