- $user = $this->userRepo->getByEmail($request->get('email'));
-
- try {
- $this->emailConfirmationService->sendConfirmation($user);
- } catch (Exception $e) {
- session()->flash('error', trans('auth.email_confirm_send_error'));
- return redirect('/register/confirm');
- }
-
- $this->emailConfirmationService->sendConfirmation($user);
- session()->flash('success', trans('auth.email_confirm_resent'));
- return redirect('/register/confirm');
- }
-
- /**
- * Redirect to the social site for authentication intended to register.
- * @param $socialDriver
- * @return mixed
- */
- public function socialRegister($socialDriver)
- {
- $this->checkRegistrationAllowed();
- session()->put('social-callback', 'register');
- return $this->socialAuthService->startRegister($socialDriver);
- }
-
- /**
- * The callback for social login services.
- * @param $socialDriver
- * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
- * @throws SocialSignInException
- */
- public function socialCallback($socialDriver)
- {
- if (session()->has('social-callback')) {
- $action = session()->pull('social-callback');
- if ($action == 'login') {
- return $this->socialAuthService->handleLoginCallback($socialDriver);
- } elseif ($action == 'register') {
- return $this->socialRegisterCallback($socialDriver);
- }
- } else {
- throw new SocialSignInException(trans('errors.social_no_action_defined'), '/login');
- }
- return redirect()->back();