コード例 #1
0
 /**
  * @param $provider_name
  * @return Response
  */
 public function login($provider_name)
 {
     $response = null;
     try {
         $provider = $this->hybrid_auth->authenticate($provider_name);
         $userProfile = $provider->getUserProfile();
         $identifier = $userProfile->identifier;
         $user = $this->user_repository->findByAuth($provider_name, $identifier);
         if ($user !== null) {
             Auth::login($user);
             $response = Redirect::intended('/');
         } else {
             $response = Redirect::route('social.register', ['provider' => $provider_name]);
         }
     } catch (Exception $e) {
         dd($e);
     }
     return $response;
 }
コード例 #2
0
 /**
  * Check if we already have a user attached to $identifer on $provider_name
  * returns true if there is a user attached, false otherwise
  *
  * @param $provider_name
  * @param $identifier
  * @return bool
  */
 public function checkRegistered($provider_name, $identifier)
 {
     $user = $this->user_repository->findbyAuth($provider_name, $identifier);
     return $user !== null;
 }