mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Updated layer2 to listen to close request from auth popup
This commit is contained in:
parent
aec178ee8b
commit
b990761136
@ -29,6 +29,16 @@ module.exports = function layer2(options) {
|
||||
return loadAuth.then(function (frame) {
|
||||
frame.src = `${authUrl}#${hash}?${query}`;
|
||||
frame.style.display = 'block';
|
||||
window.addEventListener('message', function self(event) {
|
||||
if (event.source !== frame.contentWindow) {
|
||||
return;
|
||||
}
|
||||
if (event.data !== 'pls-close-auth-popup') {
|
||||
return;
|
||||
}
|
||||
window.removeEventListener('message', self);
|
||||
frame.style.display = 'none';
|
||||
})
|
||||
return frame;
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user