コード例 #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);
 }
コード例 #2
0
 public function execute($hasCode)
 {
     if (!$hasCode) {
         return $this->getAuthFirst();
     }
     $user = $this->users->findByEmailOrCreate($this->getGithubUser());
     Auth::loginUsingId($user->id, true);
     return redirect('/profile');
 }
コード例 #3
0
ファイル: AuthenticateUser.php プロジェクト: banderon1/faces
 /**
  * @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);
 }
コード例 #4
0
 /**
  * @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);
 }
コード例 #5
0
 /**
  * @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);
 }
コード例 #6
0
 /**
  * @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);
 }