/** * @param RegisterRequest $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function register(RegisterRequest $request) { if (config('access.users.confirm_email')) { $user = $this->user->create($request->all()); event(new UserRegistered($user)); return redirect($this->redirectPath())->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.created_confirm')); } else { auth()->login($this->user->create($request->all())); event(new UserRegistered(access()->user())); return redirect($this->redirectPath()); } }
/** * @param Request $request * @param $provider * @return \Illuminate\Http\RedirectResponse|mixed * @throws GeneralException */ public function login(Request $request, $provider) { //If the provider is not an acceptable third party than kick back if (!in_array($provider, $this->helper->getAcceptedProviders())) { return redirect()->route('frontend.index')->withFlashDanger(trans('auth.socialite.unacceptable', ['provider' => $provider])); } /** * The first time this is hit, request is empty * It's redirected to the provider and then back here, where request is populated * So it then continues creating the user */ if (!$request->all()) { return $this->getAuthorizationFirst($provider); } /** * Create the user if this is a new social account or find the one that is already there */ $user = $this->user->findOrCreateSocial($this->getSocialUser($provider), $provider); /** * User has been successfully created or already exists * Log the user in */ auth()->login($user, true); /** * User authenticated, check to see if they are active. */ if (!access()->user()->isActive()) { access()->logout(); throw new GeneralException(trans('exceptions.frontend.auth.deactivated')); } /** * Throw an event in case you want to do anything when the user logs in */ event(new UserLoggedIn($user)); /** * Set session variable so we know which provider user is logged in as, if ever needed */ session([config('access.socialite_session_name') => $provider]); /** * Return to the intended url or default to the class property */ return redirect()->intended(route('frontend.index')); }
/** * @param ChangePasswordRequest $request * @return mixed */ public function changePassword(ChangePasswordRequest $request) { $this->user->changePassword($request->all()); return redirect()->route('frontend.user.account')->withFlashSuccess(trans('strings.frontend.user.password_updated')); }
/** * Display the password reset view for the given token. * * If no token is present, display the link request form. * * @param string|null $token * @return \Illuminate\Http\Response */ public function showResetForm($token = null) { return view('frontend.auth.passwords.reset')->withToken($token)->withEmail($this->user->getEmailForPasswordToken($token)); }
/** * @param $token * @return mixed */ public function confirm($token) { $this->user->confirmAccount($token); return redirect()->route('frontend.auth.login')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.success')); }
/** * @param UpdateProfileRequest $request * @return mixed */ public function update(UpdateProfileRequest $request) { $this->user->updateProfile(access()->id(), $request->all()); return redirect()->route('frontend.user.account')->withFlashSuccess(trans('strings.frontend.user.profile_updated')); }