public function ssoCheck()
 {
     $application = JFactory::getApplication();
     $user = JFactory::getUser();
     if (!$user->guest) {
         MageBridgeModelUserSSO::checkSSOLogin();
         $application->close();
     } else {
         $this->setRedirect(JURI::base());
     }
 }
 /**
  * Event onUserLogout
  * 
  * @access public
  * @param array $user
  * @param array $options
  * @return bool
  */
 public function onUserLogout($user = null, $options = array())
 {
     // Check if we can run this event or not
     if (MageBridgePluginHelper::allowEvent('onUserLogout', $options) == false) {
         return;
     }
     // Get system variables
     $application = JFactory::getApplication();
     $session = JFactory::getSession();
     $bridge = MageBridgeModelBridge::getInstance();
     $register = MageBridgeModelRegister::getInstance();
     // Remove the frontend-cookie
     setcookie('frontend', NULL, -1);
     $session->set('magento_session', null);
     // Build the bridge and fetch the result
     $arguments = array('disable_events' => 1);
     $id = $register->add('logout', null, $arguments);
     $bridge->build();
     // Check whether SSO is enabled
     if ($this->getParam('enable_sso') == 1 && isset($user['username'])) {
         if ($application->isSite() && $this->getParam('enable_auth_frontend') == 1) {
             MageBridgeModelUserSSO::doSSOLogout($user['username']);
         } else {
             if ($application->isAdmin() && $this->getParam('enable_auth_backend') == 1) {
                 MageBridgeModelUserSSO::doSSOLogout($user['username']);
             }
         }
     }
     return true;
 }
Example #3
0
 /**
  * Handle SSO checks
  *
  * @access private
  *
  * @param null
  *
  * @return null
  */
 private function handleSsoChecks()
 {
     return;
     if ($this->input->getCmd('task') == 'login') {
         $user = JFactory::getUser();
         if (!$user->guest) {
             MageBridgeModelUserSSO::checkSSOLogin();
             $this->app->close();
         }
     }
 }
Example #4
0
 /**
  * Event onUserAfterLogout
  *
  * @param array $options
  *
  * @return bool
  */
 public function onUserAfterLogout($options = array())
 {
     $application = JFactory::getApplication();
     // Check if we can run this event or not
     if (MageBridgePluginHelper::allowEvent('onUserLogout', $options) == false) {
         return true;
     }
     // Check whether SSO is enabled
     if ($this->getParam('enable_sso') == 1 && isset($options['username'])) {
         if ($application->isSite() && $this->getParam('enable_auth_frontend') == 1) {
             MageBridgeModelUserSSO::doSSOLogout($options['username']);
         } else {
             if ($application->isAdmin() && $this->getParam('enable_auth_backend') == 1) {
                 MageBridgeModelUserSSO::doSSOLogout($options['username']);
             }
         }
     }
     return true;
 }
 /**
  * Event onUserLogin
  * 
  * @access public
  * @param array $user
  * @param array $options
  * @return bool
  */
 public function onUserLogin($user = null, $options = array())
 {
     // Check if we can run this event or not
     if (MageBridgePluginHelper::allowEvent('onUserLogin', $options) == false) {
         return;
     }
     // Get system variables
     $application = JFactory::getApplication();
     // Synchronize this user-record with Magento
     if ($this->getParam('enable_usersync') == 1 && $application->isSite()) {
         $user['id'] = JFactory::getUser()->id;
         $user = $this->getUser()->synchronize($user);
     }
     // Perform a login
     $this->getUser()->login($user['email']);
     // Check whether SSO is enabled
     if ($this->getParam('enable_sso') == 1) {
         if ($application->isSite() && $this->getParam('enable_auth_frontend') == 1) {
             MageBridgeModelUserSSO::doSSOLogin($user);
         } else {
             if ($application->isAdmin() && $this->getParam('enable_auth_backend') == 1) {
                 MageBridgeModelUserSSO::doSSOLogin($user);
             }
         }
     }
     return true;
 }
 /**
  * Handle SSO checks
  * 
  * @access private
  * @param null
  * @return null
  */
 private function handleSsoChecks()
 {
     return;
     if (JRequest::getCmd('task') == 'login') {
         $application =& JFactory::getApplication();
         $user =& JFactory::getUser();
         if (!$user->guest) {
             MageBridgeModelUserSSO::checkSSOLogin();
             $application->close();
         }
     }
 }