fix: Update login URL construction in layoutauth.html and restrict postMessage targetOrigin in layout-designer-page.twig
This commit is contained in:
@@ -195,7 +195,7 @@
|
|||||||
.catch(function () {
|
.catch(function () {
|
||||||
// Not authenticated — send to the CMS login page, preserving the return URL
|
// Not authenticated — send to the CMS login page, preserving the return URL
|
||||||
var returnUrl = encodeURIComponent(window.location.href);
|
var returnUrl = encodeURIComponent(window.location.href);
|
||||||
var loginUrl = window.location.origin + "/" + slug + "/cms/login?redirect=" + returnUrl;
|
var loginUrl = window.location.origin + cmsBase + "/login?redirect=" + returnUrl;
|
||||||
window.location.replace(loginUrl);
|
window.location.replace(loginUrl);
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -576,8 +576,9 @@
|
|||||||
? document.getElementById('layout-editor').getAttribute('data-layout-id')
|
? document.getElementById('layout-editor').getAttribute('data-layout-id')
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
// TODO: For production, restrict targetOrigin to your app's domain
|
// Restrict postMessage to the known React app origin.
|
||||||
var targetOrigin = '*';
|
// window.location.origin is the CMS origin; the parent app is on the same host.
|
||||||
|
var targetOrigin = window.location.origin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to the parent window.
|
* Send a message to the parent window.
|
||||||
|
|||||||
Reference in New Issue
Block a user