Ejemplo n.º 1
0
                return include RAINLOOP_APP_LIBRARIES_PATH . \strtr($sClassName, '\\', '/') . '.php';
            }
        }
        return false;
    }
    \spl_autoload_register('rainLoopSplAutoloadRegisterFunction', false);
}
if (\class_exists('RainLoop\\Api')) {
    if (!\class_exists('MailSo\\Version', false)) {
        include APP_VERSION_ROOT_PATH . 'app/libraries/MailSo/MailSo.php';
    }
    if (\class_exists('MailSo\\Version')) {
        if (RAINLOOP_INCLUDE_AS_API_DEF) {
            if (!\defined('APP_API_STARTED')) {
                \define('APP_API_STARTED', true);
                \RainLoop\Api::Handle();
            }
        } else {
            if (!\defined('APP_STARTED')) {
                \define('APP_STARTED', true);
                \RainLoop\Api::Handle();
                \RainLoop\Service::Handle();
                \RainLoop\Api::ExitOnEnd();
            }
        }
    }
} else {
    if (\function_exists('rainLoopSplAutoloadRegisterFunction')) {
        \spl_autoload_unregister('rainLoopSplAutoloadRegisterFunction');
    }
}
 /**
  * @return string
  */
 public function ServiceExternalSso()
 {
     $sResult = '';
     $bLogout = true;
     $sKey = $this->oActions->Config()->Get('labs', 'external_sso_key', '');
     if ($this->oActions->Config()->Get('labs', 'allow_external_sso', false) && !empty($sKey) && $sKey === \trim($this->oHttp->GetRequest('SsoKey', ''))) {
         $sEmail = \trim($this->oHttp->GetRequest('Email', ''));
         $sPassword = $this->oHttp->GetRequest('Password', '');
         \RainLoop\Api::Handle();
         $sResult = \RainLoop\Api::GetUserSsoHash($sEmail, $sPassword);
         $bLogout = 0 === \strlen($sResult);
         switch (\strtolower($this->oHttp->GetRequest('Output', 'Plain'))) {
             case 'plain':
                 @\header('Content-Type: text/plain');
                 break;
             case 'json':
                 @\header('Content-Type: application/json; charset=utf-8');
                 $sResult = \MailSo\Base\Utils::Php2js(array('Action' => 'ExternalSso', 'Result' => $sResult), $this->Logger());
                 break;
         }
     }
     if ($bLogout) {
         $this->oActions->SetAuthLogoutToken();
     }
     return $sResult;
 }