Skip to content

Commit 37d8f66

Browse files
authored
Merge pull request #1758 from mercihabam/fix-session-expire
fix(frontend): prevent page handlers from executing when user is logged out, and logout users when ajax requests fail with an invalid session response
2 parents f8ce661 + aa9883b commit 37d8f66

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/core/navigation/navigation.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ window.addEventListener('popstate', function(event) {
3030
});
3131

3232
window.addEventListener('load', function() {
33+
if (!hm_is_logged()) {
34+
return;
35+
}
36+
3337
const unMountCallback = renderPage(window.location.href);
3438
history.replaceState({ main: $('#cypht-main').prop('outerHTML'), scripts: extractCustomScripts($(document)) }, "");
3539

modules/core/site.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ var Hm_Ajax_Request = function() { return {
246246
res = Hm_Utils.json_decode(Hm_Crypt.decrypt(res.payload));
247247
}
248248
if ((res.status && res.status == 'not callable') || !res.router_login_state) {
249-
this.fail(xhr, true);
249+
this.fail(xhr, true, !res.router_login_state);
250250
return;
251251
}
252252
if (Hm_Ajax.err_condition) {

0 commit comments

Comments
 (0)