diff --git a/index.php b/index.php index 8bcde159..21b3c22c 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,5 @@ www.pathfinder.com/pathfinder/ -> /pathfinder + * @returns {string|string} + */ + var getDocumentPath = function(){ + var pathname = window.location.pathname; + // replace file endings + var r = /[^\/]*$/; + var path = pathname.replace(r, ''); + return path || '/'; + }; + /** * redirect * @param url @@ -1919,6 +1932,7 @@ define([ convertDateToString: convertDateToString, getOpenDialogs: getOpenDialogs, formatPrice: formatPrice, + getDocumentPath: getDocumentPath, redirect: redirect, logout: logout }; diff --git a/public/js/v1.1.1/app/login.js b/public/js/v1.1.1/app/login.js index ad257de6..d3baaab8 100644 --- a/public/js/v1.1.1/app/login.js +++ b/public/js/v1.1.1/app/login.js @@ -77,7 +77,8 @@ define([ var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = 'expires=' + d.toUTCString(); - document.cookie = cname + '=' + cvalue + '; ' + expires; + var path = 'path=' + Util.getDocumentPath(); + document.cookie = cname + '=' + cvalue + '; ' + expires + '; ' + path; }; /** diff --git a/public/js/v1.1.1/app/util.js b/public/js/v1.1.1/app/util.js index def5eb5c..102a6499 100644 --- a/public/js/v1.1.1/app/util.js +++ b/public/js/v1.1.1/app/util.js @@ -1824,6 +1824,19 @@ define([ return dateString + ' ' + timeString; }; + /** + * get document path + * -> www.pathfinder.com/pathfinder/ -> /pathfinder + * @returns {string|string} + */ + var getDocumentPath = function(){ + var pathname = window.location.pathname; + // replace file endings + var r = /[^\/]*$/; + var path = pathname.replace(r, ''); + return path || '/'; + }; + /** * redirect * @param url @@ -1919,6 +1932,7 @@ define([ convertDateToString: convertDateToString, getOpenDialogs: getOpenDialogs, formatPrice: formatPrice, + getDocumentPath: getDocumentPath, redirect: redirect, logout: logout };