Ensure expired sessions for ajax calls get immediately redirected.
This commit is contained in:
		
							parent
							
								
									7e3d12db84
								
							
						
					
					
						commit
						1ef310a2b7
					
				
							
								
								
									
										20
									
								
								js/comics.js
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								js/comics.js
									
									
									
									
									
								
							| 
						 | 
					@ -22,7 +22,10 @@ function getFolderContents() {
 | 
				
			||||||
      url      : 'ajax/getfoldercontents.php',
 | 
					      url      : 'ajax/getfoldercontents.php',
 | 
				
			||||||
      dataType : 'json',
 | 
					      dataType : 'json',
 | 
				
			||||||
      success  : function(data, stat, jqo) {
 | 
					      success  : function(data, stat, jqo) {
 | 
				
			||||||
                    if ( !data.validated ) redirectToLogin();
 | 
					                    if ( !data.validated ) {
 | 
				
			||||||
 | 
					                       redirectToLogin();
 | 
				
			||||||
 | 
					                       return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    curpath = data.compath;
 | 
					                    curpath = data.compath;
 | 
				
			||||||
                    updatePathNavigator();
 | 
					                    updatePathNavigator();
 | 
				
			||||||
                    data.contents.forEach(function(entry, index) {
 | 
					                    data.contents.forEach(function(entry, index) {
 | 
				
			||||||
| 
						 | 
					@ -52,8 +55,11 @@ function changeFolder(name, path) {
 | 
				
			||||||
      data     : {path: path},
 | 
					      data     : {path: path},
 | 
				
			||||||
      dataType : 'json',
 | 
					      dataType : 'json',
 | 
				
			||||||
      success  : function(data, stat, jqo) {
 | 
					      success  : function(data, stat, jqo) {
 | 
				
			||||||
 | 
					                    if ( !data.validated ) {
 | 
				
			||||||
 | 
					                       redirectToLogin();
 | 
				
			||||||
 | 
					                       return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    console.log(data.message);
 | 
					                    console.log(data.message);
 | 
				
			||||||
                    if ( !data.validated ) redirectToLogin();
 | 
					 | 
				
			||||||
                    curpath = path;
 | 
					                    curpath = path;
 | 
				
			||||||
                    parentpath = data.parentpath;
 | 
					                    parentpath = data.parentpath;
 | 
				
			||||||
                    foldername = data.foldername;
 | 
					                    foldername = data.foldername;
 | 
				
			||||||
| 
						 | 
					@ -69,7 +75,10 @@ function updateCurrentPage() {
 | 
				
			||||||
      data     : {page: currentPage},
 | 
					      data     : {page: currentPage},
 | 
				
			||||||
      dataType : 'json',
 | 
					      dataType : 'json',
 | 
				
			||||||
      success  : function(data, stat, jqo) {
 | 
					      success  : function(data, stat, jqo) {
 | 
				
			||||||
                    if ( !data.validated ) redirectToLogin();
 | 
					                    if ( !data.validated ) {
 | 
				
			||||||
 | 
					                       redirectToLogin();
 | 
				
			||||||
 | 
					                       return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    console.log(data.message);
 | 
					                    console.log(data.message);
 | 
				
			||||||
                 }
 | 
					                 }
 | 
				
			||||||
   });
 | 
					   });
 | 
				
			||||||
| 
						 | 
					@ -89,7 +98,10 @@ function showComic(comic, name) {
 | 
				
			||||||
      data     : {comic: comic},
 | 
					      data     : {comic: comic},
 | 
				
			||||||
      dataType : 'json',
 | 
					      dataType : 'json',
 | 
				
			||||||
      success  : function(data, stat, jqo) {
 | 
					      success  : function(data, stat, jqo) {
 | 
				
			||||||
                    if ( !data.validated ) redirectToLogin();
 | 
					                    if ( !data.validated ) {
 | 
				
			||||||
 | 
					                       redirectToLogin();
 | 
				
			||||||
 | 
					                       return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    // Clear out the debug DIV and start the fancybox.
 | 
					                    // Clear out the debug DIV and start the fancybox.
 | 
				
			||||||
                    $("#debug").html("");
 | 
					                    $("#debug").html("");
 | 
				
			||||||
                    lightbox = SimpleLightbox.open({
 | 
					                    lightbox = SimpleLightbox.open({
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user