mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-10-30 17:54:59 +00:00 
			
		
		
		
	Update logout page
This commit is contained in:
		| @@ -13,12 +13,12 @@ ComunicWeb.pages.logout = { | ||||
|      * @param {element} targetElement Where the template will be applied | ||||
|      * @returns {Boolean} False if it fails  | ||||
|      */ | ||||
|     openLogoutPage: function(additionnalData, targetElement){ | ||||
|     openLogoutPage: async function(additionnalData, targetElement){ | ||||
|         //Enable screen overlay | ||||
|         var screenOverlay = ComunicWeb.common.page.showTransparentWaitSplashScreen(); | ||||
|  | ||||
|         //Perform logout | ||||
|         ComunicWeb.user.userLogin.logoutUser(); | ||||
|         await UserLogin.logoutUser(); | ||||
|  | ||||
|         //Reset notifications number | ||||
|         ComunicWeb.common.pageTitle.setNotificationsNumber(0); | ||||
|   | ||||
| @@ -145,32 +145,12 @@ const UserLogin = { | ||||
|  | ||||
|     /** | ||||
|      * Logout user | ||||
|      *  | ||||
|      * @param {Function} afterLogout What to do once user is logged out | ||||
|      */ | ||||
|     logoutUser: async function(afterLogout){ | ||||
|  | ||||
|     logoutUser: async function(){ | ||||
|         try { | ||||
|             await api("account/logout", {}, true); | ||||
|             await UserWebSocket.Disconnect(); | ||||
|  | ||||
|         //Prepare and make an API request | ||||
|         var apiURI = "user/disconnectUSER"; | ||||
|         var params = {}; | ||||
|  | ||||
|         //What to do after the request is completed | ||||
|         var afterAPIrequest = function(result){ | ||||
|  | ||||
|             //Log | ||||
|             ComunicWeb.debug.logMessage("Logout request on server terminated."); | ||||
|  | ||||
|             //Perform next action (if specified) | ||||
|             if(afterLogout){ | ||||
|                 afterLogout(); | ||||
|             } | ||||
|  | ||||
|         }; | ||||
|  | ||||
|         //Perform request | ||||
|         ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, afterAPIrequest); | ||||
|  | ||||
|             //Destroy login tokens | ||||
|             ComunicWeb.user.loginTokens.deleteLoginTokens(); | ||||
| @@ -179,8 +159,9 @@ const UserLogin = { | ||||
|             this.__userID = 0; | ||||
|             this.__userLogin = false; | ||||
|  | ||||
|         //Done ! | ||||
|         return 0; | ||||
|         } catch(e) { | ||||
|             console.error(e); | ||||
|         } | ||||
|     }, | ||||
|  | ||||
|     /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user