registerByHybridAuth() public méthode

public registerByHybridAuth ( $hybridAuthProfile )
 public function loginByHybridAuth($provider)
 {
     if (!Yum::module()->loginType & UserModule::LOGIN_BY_HYBRIDAUTH) {
         throw new CException(400, 'Hybrid authentification is not allowed');
     }
     if (!Yum::hasModule('profile')) {
         throw new CException(400, 'Hybrid auth needs the profile submodule to be enabled');
     }
     Yii::import('user.vendors.hybridauth.Hybrid.Auth', true);
     Yii::import('user.profile.models.*');
     require_once Yum::module()->hybridAuthConfigFile;
     try {
         $hybridauth = new Hybrid_Auth(Yum::module()->hybridAuthConfigFile);
         $providers = Yum::module()->hybridAuthProviders;
         if (count($providers) == 0) {
             throw new CException('No Hybrid auth providers enabled in configuration file');
         }
         if (!in_array($provider, $providers)) {
             throw new CException('Requested provider is not enabled in configuration file');
         }
         $success = $hybridauth->authenticate($provider);
         if ($success && $success->isUserConnected()) {
             // User found and authenticated at foreign party. Is he already
             // registered at our application?
             $hybridAuthProfile = $success->getUserProfile();
             $user = $this->getUserByEmail($hybridAuthProfile->email);
             if (!$user && !YumProfile::model()->findByAttributes(array('email' => $hybridAuthProfile->email))) {
                 // No, he is not, so we register the user and sync the profile fields
                 $user = new YumUser();
                 if (!$user->registerByHybridAuth($hybridAuthProfile)) {
                     Yum::setFlash(Yum::t('Registration by external provider failed'));
                     $this->redirect(Yum::module()->returnUrl);
                 } else {
                     Yum::setFlash('Registration successful');
                 }
             }
             $identity = new YumUserIdentity($user->username, null);
             if ($identity->authenticate(true)) {
                 Yum::log(Yum::t('User {username} logged in by hybrid {provider}', array('{username}' => $hybridAuthProfile->displayName, '{email}' => $hybridAuthProfile->displayName, '{provider}' => $provider)));
                 Yii::app()->user->login($identity, Yum::module()->cookieDuration);
             } else {
                 Yum::setFlash(Yum::t('Login by external provider failed'));
             }
             $this->redirect(Yum::module()->returnUrl);
         }
     } catch (Exception $e) {
         if (Yum::module()->debug) {
             throw new CException($e->getMessage());
         } else {
             throw new CHttpException(403, Yum::t('Permission denied'));
         }
     }
 }