/** * Handle a registration request for the application. * * @param RegisterRequest $request * @param \App\User\Repository $repository * * @return Response */ public function postRegister(RegisterRequest $request, UserRepository $repository) { // Create a new user record. // $user = $repository->create($request->get('email'), $request->get('passsord')); // Log the user into their account. // $this->auth->login($user); // Redirect the user. // return redirect('/'); }
/** * Handle a POST request to reset a user's password. * * @param Request $request * @param UserRepository $repository * * @return Response */ public function postReset(ResetRequest $request, UserRepository $repository) { // Capture the credentials from postback. // $credentials = $request->only('email', 'password', 'password_confirmation', 'token'); // Fetch the user account by the email address. // $user = $repository->findByEmail($request->get('email')); // Reset the user's account and prepare our response. // $response = $this->passwords->reset($credentials, function ($user, $password) { $user->password = $password; $user->save(); }); switch ($response) { case PasswordBroker::INVALID_PASSWORD: case PasswordBroker::INVALID_TOKEN: case PasswordBroker::INVALID_USER: // Flash an error message to the user. // Flash::error(trans($response)); // Redirect the user back to the page and re-populate the // form with what they had submitted. // return redirect()->back()->withInput(); case PasswordBroker::PASSWORD_RESET: // Redirect the user back to the homepage. // return redirect()->to('/'); } }