/** * @param PostRecoverAccountRequest $request * * @return \Illuminate\Http\RedirectResponse */ public function postEmail(PostRecoverAccountRequest $request) { $user = $this->userRepository->findByEmail($request->get('email')); $user = $this->userRepository->generateRecoveryToken($user); $this->mailer->sendRecoveryEmail($user); Flash::success(trans('ahk_messages.check_your_email_to_recover_account')); return redirect()->back(); }
/** * Store a newly created resource in storage. * * @param Requests\Ahk\StoreUserRequest $request * * @return Response */ public function postRegistration(Requests\Ahk\StoreUserRequest $request) { $userIsStored = $this->userRepository->storeCompanyRepresentativeAccount($request->only('email', 'password')); if (!$userIsStored) { Flash::error(trans('ahk_messages.unable_to_store_user')); return redirect()->back(); } Flash::success(trans('ahk_messages.user_created')); if (!$this->appMailer->sendEmailConfirmation($userIsStored)) { return redirect()->back(); } Flash::success(trans('ahk_messages.check_your_email_and_complete_registration')); return redirect()->route('auth.sign_in'); }