File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed
Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 1+ function logout ( ) {
2+ window . location . href = window . location . href ;
3+ }
Original file line number Diff line number Diff line change @@ -102,6 +102,16 @@ async function navigate(url, loaderMessage) {
102102 if ( ! html || typeof html !== 'string' ) {
103103 throw new Error ( "Failed navigating to page, empty or invalid response body." ) ;
104104 }
105+
106+ // load custom javascript
107+ const scripts = extractCustomScripts ( $ ( html ) ) ;
108+ loadCustomScripts ( scripts ) ;
109+
110+ if ( ! hm_is_logged ( ) ) {
111+ logout ( ) ;
112+ return ;
113+ }
114+
105115 const titleMatch = html . match ( / < t i t l e [ ^ > ] * > ( [ \s \S ] * ?) < \/ t i t l e > / i) ;
106116 if ( ! titleMatch ) {
107117 throw new Error ( "No <title> element found in response HTML" ) ;
@@ -127,10 +137,6 @@ async function navigate(url, loaderMessage) {
127137 cyphtMain = innerMain . prop ( 'outerHTML' ) ;
128138 }
129139 document . title = title . replace ( / < [ ^ > ] * > / g, '' ) ;
130-
131- // load custom javascript
132- const scripts = extractCustomScripts ( $ ( html ) ) ;
133- loadCustomScripts ( scripts ) ;
134140
135141 window . location . next = url ;
136142
Original file line number Diff line number Diff line change @@ -245,8 +245,8 @@ var Hm_Ajax_Request = function() { return {
245245 if ( hm_encrypt_ajax_requests ( ) ) {
246246 res = Hm_Utils . json_decode ( Hm_Crypt . decrypt ( res . payload ) ) ;
247247 }
248- if ( ( res . state && res . state == 'not callable' ) || ! res . router_login_state ) {
249- this . fail ( xhr , true ) ;
248+ if ( ( res . status && res . status == 'not callable' ) || ! res . router_login_state ) {
249+ this . fail ( xhr , true , ! res . router_login_state ) ;
250250 return ;
251251 }
252252 if ( Hm_Ajax . err_condition ) {
@@ -277,7 +277,11 @@ var Hm_Ajax_Request = function() { return {
277277 return false ;
278278 } ,
279279
280- fail : function ( xhr , not_callable ) {
280+ fail : function ( xhr , not_callable , shouldLogout ) {
281+ if ( shouldLogout ) {
282+ logout ( ) ;
283+ return ;
284+ }
281285 if ( not_callable === true || ( xhr . status && xhr . status == 500 ) ) {
282286 Hm_Notices . show ( 'Server Error' , 'danger' ) ;
283287 }
You can’t perform that action at this time.
0 commit comments