File indexing completed on 2024-12-29 05:24:45
0001 <?php 0002 /** @var Zend_Controller_Request_Http $request */ 0003 $request = Zend_Controller_Front::getInstance()->getRequest(); 0004 $token = $request->getCookie(Default_Model_SingleSignOnToken::ACTION_LOGIN, null); 0005 $modelSso = new Default_Model_SingleSignOnToken(); 0006 if (isset($token) AND $modelSso->isValid($token)) : 0007 $store_config_list = Zend_Registry::get('application_store_config_list'); 0008 0009 $urls = ''; 0010 foreach ($store_config_list as $key => $item) { 0011 if (empty($item['cross_domain_login'])) { 0012 continue; 0013 } 0014 $urls .= "'//{$key}/login/propagate/',"; 0015 } 0016 $urls = substr($urls, 0, -1); ?> 0017 <script type="application/javascript"> 0018 $(document).ready(function(){ 0019 urls = [<?=$urls?>]; 0020 origin = 'http://<?=$_SERVER["HTTP_HOST"]?>'; 0021 token = '<?=$token?>'; 0022 0023 var propagateLogin = (function () { 0024 return { 0025 process: function (origin, token, urls) { 0026 for (var i = 0; i < urls.length; i++) { 0027 var data = {'origin': origin, 'token': token}; 0028 var request_config = { 0029 'type': 'POST', 0030 'dataType': 'text', 0031 'cache': false, 0032 'data': data, 0033 'url': urls[i], 0034 'xhrFields': { 0035 'withCredentials': true 0036 } 0037 }; 0038 $.ajax(request_config); 0039 } 0040 } 0041 } 0042 })(); 0043 0044 propagateLogin.process(origin, token, urls); 0045 }); 0046 </script> 0047 <?php 0048 setcookie(Default_Model_SingleSignOnToken::ACTION_LOGIN, false, time() - 38500, '/',Local_Tools_ParseDomain::get_domain($request->getHttpHost()), null, true); 0049 endif; 0050