private function hybridAuth()
	{
        // Preload some configuration options
        if (strtolower($this->getProvider()) == 'openid')
		{
			if (!isset($_GET['openid-identity']))
				throw new CException(Yii::t('Hybridauth.main', "You chose OpenID but didn't provide an OpenID identifier"));
			else
				$params = array("openid_identifier" => $_GET['openid-identity']);
		}
		else
			$params = array();

        // Load HybridAuth
        $hybridauth = new Hybrid_Auth(Yii::app()->controller->module->getConfig());

        if (!$this->adapter)
            $this->setAdapter($hybridauth->authenticate($this->getProvider(),$params));

        // Proceed if we've been connected
        if ($this->adapter->isUserConnected())
		{
            // If we have an identity on file, then autheticate as that user.
            if ($this->authenticate())
            {
                Yii::app()->user->setFlash('success', Yii::t('HybridAuth.main', 'You have been sucessfully logged in!'));
                if (isset($_GET['next']))
                    $this->redirect($this->createUrl($_GET['next']));
                $this->redirect(Yii::app()->getBaseUrl(true));
            }
            else
            {
                // If we DON'T have information about this user already on file
                // If they're not a guest, present them with a form to link their accounts
                // Otherwise present them with a registration form
                // We want remote users to have their own identity, rather than just dangling and not being able to actually interact with our site
                if (!Yii::app()->user->isGuest)
                    $this->renderLinkForm();
                else
                    $this->renderRegisterForm();
            }
        }
        else
            throw new CHttpException(403, Yii::t('HybridAuth.main', 'Failed to establish remote identity'));
	}
private function hybridAuth()
	{
        // Preload some configuration options
        if (strtolower($this->getProvider()) == 'openid')
		{
			if (!isset($_GET['openid-identity']))
				throw new CException(Yii::t('Hybridauth.main', "You chose OpenID but didn't provide an OpenID identifier"));
			else
				$params = array("openid_identifier" => $_GET['openid-identity']);
		}
		else
			$params = array();

        // Load HybridAuth
        $hybridauth = new Hybrid_Auth(Yii::app()->controller->module->getConfig());

        if (!$this->adapter)
            $this->setAdapter($hybridauth->authenticate($this->getProvider(),$params));

        // Proceed if we've been connected
        if ($this->adapter->isUserConnected())
		{
            // If we have an identity on file, then autheticate as that user.
            if ($this->authenticate())
            {
                Yii::app()->user->setFlash('success', Yii::t('HybridAuth.main', 'You have been sucessfully logged in!'));
                if (isset($_GET['next']))
                    $this->redirect($this->createUrl($_GET['next']));
                $this->redirect(Yii::app()->getBaseUrl(true));
            }
            else
            {
                // If we DON'T have information about this user already on file
                // If they're not a guest, present them with a form to link their accounts
                // Otherwise present them with a registration form
                // We want remote users to have their own identity, rather than just dangling and not being able to actually interact with our site
                if (!Yii::app()->user->isGuest)
                    $this->renderLinkForm();
                else
                    $this->renderRegisterForm();
            }
        }
        else
            throw new CHttpException(403, Yii::t('HybridAuth.main', 'Failed to establish remote identity'));
	}
private function hybridAuth ( ) { // Preload some configuration options if ( strtolower ( $ this -> getProvider ( ) ) == 'openid' ) { if ( ! isset ( $ _GET [ 'openid-identity' ] ) ) throw new CException ( Yii :: t ( 'Hybridauth.main' , "You chose OpenID but didn't provide an OpenID identifier" ) ) ; else $ params = array ( "openid_identifier" => $ _GET [ 'openid-identity' ] ) ; } else $ params = array ( ) ; // Load HybridAuth $ hybridauth = new Hybrid_Auth ( Yii :: app ( ) -> controller -> module -> getConfig ( ) ) ; if ( ! $ this -> adapter ) $ this -> setAdapter ( $ hybridauth -> authenticate ( $ this -> getProvider ( ) , $ params ) ) ; // Proceed if we've been connected if ( $ this -> adapter -> isUserConnected ( ) ) { // If we have an identity on file, then autheticate as that user. if ( $ this -> authenticate ( ) ) { Yii :: app ( ) -> user -> setFlash ( 'success' , Yii :: t ( 'HybridAuth.main' , 'You have been sucessfully logged in!' ) ) ; if ( isset ( $ _GET [ 'next' ] ) ) $ this -> redirect ( $ this -> createUrl ( $ _GET [ 'next' ] ) ) ; $ this -> redirect ( Yii :: app ( ) -> getBaseUrl ( true ) ) ; } else { // If we DON'T have information about this user already on file // If they're not a guest, present them with a form to link their accounts // Otherwise present them with a registration form // We want remote users to have their own identity, rather than just dangling and not being able to actually interact with our site if ( ! Yii :: app ( ) -> user -> isGuest ) $ this -> renderLinkForm ( ) ; else $ this -> renderRegisterForm ( ) ; } } else throw new CHttpException ( 403 , Yii :: t ( 'HybridAuth.main' , 'Failed to establish remote identity' ) ) ; }
Handles authenticating the user against the remote identity
Handles authenticating the user against the remote identity