Exemplo n.º 1
0
 /**
  * @param boolean $hasCode
  * @param AuthenticateUserListener $listener
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function execute($hasCode, AuthenticateUserListener $listener, $provider)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst($provider);
     }
     $user = $this->users->findByEmailOrCreate($this->getSocialUser($provider));
     \Auth::login($user, true);
     return $listener->userHasLoggedIn($user);
 }
 public function execute($hasCode)
 {
     if (!$hasCode) {
         return $this->getAuthFirst();
     }
     $user = $this->users->findByEmailOrCreate($this->getGithubUser());
     Auth::loginUsingId($user->id, true);
     return redirect('/profile');
 }
Exemplo n.º 3
0
 /**
  * @param string $driver facebook/twitter/google+/github/etc
  * @param bool $hasCode
  * @param AuthenticateUserListener $listener
  * @return mixed
  */
 public function execute($driver, $hasCode, AuthenticateUserListener $listener)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst($driver);
     }
     $user = $this->users->findByEmailOrCreate($this->getUser($driver));
     $this->auth->login($user, true);
     return $listener->userHasLoggedIn($user);
 }
 /**
  * @param $hasCode
  * @param $listener
  * @param $social_provider
  * @return mixed
  */
 public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst($social_provider);
     }
     $user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider));
     if ($user == 'isDuplicate') {
         Session::flash('message', "There some problems with your login! Credentials do not match. ");
         Session::flash('alert-class', 'alert-danger');
         return redirect()->back();
     }
     $this->auth->login($user, true);
     return $listener->userHasLoggedIn($user);
 }
 /**
  * @param $hasCode
  * @param $listener
  * @param $social_provider
  * @return mixed
  */
 public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
 {
     //        dd($hasCode);
     if (!$hasCode) {
         return $this->getAuthorizationFirst($social_provider);
     }
     $user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider));
     if (!$user) {
         Session::flash('message', "Something went wrong!");
         Session::flash('alert-class', 'error');
     }
     $this->auth->login($user, true);
     //        event(new \App\Events\UserEvent($user->full_name));
     return $listener->userHasBeenRegistered($user);
 }
 /**
  * @param $hasCode
  * @param $listener
  * @param $social_provider
  * @return mixed
  */
 public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst($social_provider);
     }
     $user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider), $this->ip);
     if (!$user) {
         Session::flash('message', "Something went wrong!");
         Session::flash('alert-class', 'error');
     } else {
         if ($user == 'user exist') {
             return redirect()->route('home');
         }
     }
     return $listener->userHasBeenRegistered($user);
 }