Skip to content

Commit

Permalink
redirect at home when session end
Browse files Browse the repository at this point in the history
  • Loading branch information
aynsix committed Oct 26, 2023
1 parent fc3baaf commit 766448e
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Phraseanet-production-client/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ module.exports = {
setupDir: _root + 'tests/setup/node.js',
karmaConf: _root + 'config/karma.conf.js',
// change this version when you change JS file for lazy loading
assetFileVersion: 95
assetFileVersion: 96
};
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=95";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=96";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/authenticate.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=95";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=96";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=95";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=96";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
2 changes: 1 addition & 1 deletion Phraseanet-production-client/dist/commons.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=95";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=96";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
Expand Down
5 changes: 5 additions & 0 deletions Phraseanet-production-client/dist/lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,11 @@ var download = function download(services) {
success: function success(data) {
$dialog.setContent(data);
_onDownloadReady($dialog, window.exportConfig);
},
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
}
});

Expand Down
5 changes: 5 additions & 0 deletions Phraseanet-production-client/dist/lightbox.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,11 @@ var download = function download(services) {
success: function success(data) {
$dialog.setContent(data);
_onDownloadReady($dialog, window.exportConfig);
},
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
}
});

Expand Down
33 changes: 31 additions & 2 deletions Phraseanet-production-client/dist/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -4391,6 +4391,10 @@ var sharebasketModal = function sharebasketModal(services, datas) {
$dialog.setContent(data);
_onDialogReady();
return;
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
});

return true;
Expand Down Expand Up @@ -5543,8 +5547,11 @@ var editRecord = function editRecord(services) {
(0, _jquery2.default)('#tooltip').hide();
return;
},
error: function error(XHR, textStatus, errorThrown) {
if (XHR.status === 0) {
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
if (data.status === 0) {
return false;
}
}
Expand Down Expand Up @@ -7487,6 +7494,11 @@ var exportRecord = function exportRecord(services) {
} else {
_onExportReady($dialog, window.exportConfig);
}
},
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
}
});

Expand Down Expand Up @@ -19941,6 +19953,10 @@ var basketCreate = function basketCreate(services) {
$dialog.setContent(data);
_onDialogReady();
return;
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
});
};

Expand Down Expand Up @@ -20073,6 +20089,11 @@ var storyCreate = function storyCreate(services) {
_onDialogReady();

return;
},
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
}
});
};
Expand Down Expand Up @@ -20280,6 +20301,10 @@ var basketUpdate = function basketUpdate(services) {
$dialog.setContent(data);
_onDialogReady();
return;
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
});
};

Expand Down Expand Up @@ -62758,6 +62783,10 @@ var recordToolsModal = function recordToolsModal(services, datas) {
$dialog.setOption('contextArgs', datas);
_onModalReady(data, window.toolsConfig, activeTab);
return;
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
});
};

Expand Down
33 changes: 31 additions & 2 deletions Phraseanet-production-client/dist/production.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -4391,6 +4391,10 @@ var sharebasketModal = function sharebasketModal(services, datas) {
$dialog.setContent(data);
_onDialogReady();
return;
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
});

return true;
Expand Down Expand Up @@ -5543,8 +5547,11 @@ var editRecord = function editRecord(services) {
(0, _jquery2.default)('#tooltip').hide();
return;
},
error: function error(XHR, textStatus, errorThrown) {
if (XHR.status === 0) {
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
if (data.status === 0) {
return false;
}
}
Expand Down Expand Up @@ -7487,6 +7494,11 @@ var exportRecord = function exportRecord(services) {
} else {
_onExportReady($dialog, window.exportConfig);
}
},
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
}
});

Expand Down Expand Up @@ -19941,6 +19953,10 @@ var basketCreate = function basketCreate(services) {
$dialog.setContent(data);
_onDialogReady();
return;
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
});
};

Expand Down Expand Up @@ -20073,6 +20089,11 @@ var storyCreate = function storyCreate(services) {
_onDialogReady();

return;
},
error: function error(data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
}
});
};
Expand Down Expand Up @@ -20280,6 +20301,10 @@ var basketUpdate = function basketUpdate(services) {
$dialog.setContent(data);
_onDialogReady();
return;
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
});
};

Expand Down Expand Up @@ -62758,6 +62783,10 @@ var recordToolsModal = function recordToolsModal(services, datas) {
$dialog.setOption('contextArgs', datas);
_onModalReady(data, window.toolsConfig, activeTab);
return;
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
});
};

Expand Down
8 changes: 7 additions & 1 deletion Phraseanet-production-client/src/components/basket/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ const basketCreate = (services) => {
$dialog.setContent(data);
_onDialogReady();
return;
});
})
.fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
})
;
};

const _onDialogReady = () => {
Expand Down
7 changes: 6 additions & 1 deletion Phraseanet-production-client/src/components/basket/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ const basketUpdate = (services) => {
$dialog.setContent(data);
_onDialogReady();
return;
});
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
})
;
};

const _onDialogReady = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ const download = (services) => {
success: function (data) {
$dialog.setContent(data);
_onDownloadReady($dialog, window.exportConfig);
},
error: function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
}
});

Expand Down
7 changes: 5 additions & 2 deletions Phraseanet-production-client/src/components/record/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ const editRecord = (services) => {
$('#tooltip').hide();
return;
},
error: function (XHR, textStatus, errorThrown) {
if (XHR.status === 0) {
error: function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
if (data.status === 0) {
return false;
}
}
Expand Down
5 changes: 5 additions & 0 deletions Phraseanet-production-client/src/components/record/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ const exportRecord = services => {
} else {
_onExportReady($dialog, window.exportConfig);
}
},
error: function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ const sharebasketModal = (services, datas) => {
$dialog.setContent(data);
_onDialogReady();
return;
});
}).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
})
;

return true;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ const recordToolsModal = (services, datas, activeTab = false) => {
_onModalReady(data, window.toolsConfig, activeTab);
return;
}
);
).fail(function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
});
};


Expand Down
7 changes: 6 additions & 1 deletion Phraseanet-production-client/src/components/story/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ const storyCreate = (services) => {
_onDialogReady();

return;
}
},
error: function (data) {
if (data.status === 403 && data.getResponseHeader('x-phraseanet-end-session')) {
self.location.replace(self.location.href); // refresh will redirect to login
}
},
});
};

Expand Down
2 changes: 1 addition & 1 deletion lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getGlobals()
{
return [
// change this version when you change JS file to force the navigation to reload js file
'assetFileVersion' => 95
'assetFileVersion' => 96
];

}
Expand Down

0 comments on commit 766448e

Please sign in to comment.