Skip to content

Commit 308d43f

Browse files
committed
10660-Back-Login-Redirect-Issue
1 parent 9da1985 commit 308d43f

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © Magefan ([email protected]). All rights reserved.
4+
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
5+
*/
6+
?>
7+
<?php
8+
/**
9+
* @var $block \Magefan\Community\Block\JsScript
10+
*/
11+
?>
12+
<script data-mfmofile="true">
13+
window.MagefanJs = window.MagefanJs || {};
14+
window.MagefanJs.getCookies = function getCookies(options) {
15+
let name = options + "=";
16+
let decodedCookie = decodeURIComponent(document.cookie);
17+
let ca = decodedCookie.split(';');
18+
for(let i = 0; i <ca.length; i++) {
19+
let c = ca[i];
20+
while (c.charAt(0) == ' ') {
21+
c = c.substring(1);
22+
}
23+
if (c.indexOf(name) == 0) {
24+
return c.substring(name.length, c.length);
25+
}
26+
}
27+
return "";
28+
}
29+
</script>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright © Magefan ([email protected]). All rights reserved.
4+
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
5+
*/
6+
?>
7+
<?php
8+
/**
9+
* @var $block \Magefan\Community\Block\JsScript
10+
*/
11+
?>
12+
<script data-mfmofile="true">
13+
window.MagefanJs = window.MagefanJs || {};
14+
window.MagefanJs.setCookies = function setCookies(options) {
15+
options = options || {};
16+
if (!options.name || !options.value) {
17+
return;
18+
}
19+
var expires = options.expires;
20+
var path = options.path || '/';
21+
var domain = options.domain || window.location.hostname;
22+
23+
var cookieString = encodeURIComponent(options.name) + '=' + encodeURIComponent(options.value);
24+
25+
if (expires instanceof Date) {
26+
cookieString += '; expires=' + expires.toUTCString();
27+
}
28+
cookieString += '; path=' + path;
29+
cookieString += '; domain=' + domain;
30+
document.cookie = cookieString;
31+
};
32+
33+
</script>

0 commit comments

Comments
 (0)