I'm modifying Guacamole's frontend to display fatal errors as notifications
instead of the default absolute error page because my users, that are
learning to use a PC get scared by it and the internet is very unstable
sometimes However, triggering guacFatalPageError still leads to a logout,
even though the authentication token remains stored.
*Steps to Reproduce:*

   1. Replace the absolute error page with a notification in
   indexController.js:

   javascript
   CopyEdit
   $scope.$on('guacFatalPageError', function fatalPageError(error) {
       guacNotification.showStatus({
           className : 'error',
           title     : 'APP.DIALOG_HEADER_ERROR',
           text      : { key: 'APP.ERROR_PAGE_UNAVAILABLE' },
           actions   : [{
               name: "APP.ACTION_RECONNECT",
               callback: function () {
                   console.warn("Debug: Reloading application...");
                   window.location.reload();
               }
           }]
       });
   });

   2. Check for forced logouts by searching for guacLogout:

   sh
   CopyEdit
   grep -ril "guacLogout"

   - Only found direct occurrences in indexController.js,
      authenticationService.js, cacheService.js, and
      sessionStorageFactory.js.
   3. Attempt to prevent logout on fatal errors by modifying guacLogout
   handling:

   javascript
   CopyEdit
   $scope.$on('guacLogout', function loggedOut() {
       if ($scope.applicationState !== ApplicationState.FATAL_ERROR) {
           console.warn("Debug: Logging out user.");
           $scope.applicationState = ApplicationState.LOGGED_OUT;
           $scope.reAuthenticating = false;
       } else {
           console.warn("Skipped logout due to fatal error.");
       }
   });

   4. Confirm the token remains stored after a fatal error, yet the session
   is lost.

*Expected Behavior:*

   - Display the error as a notification, allowing the user to reconnect
   without logging out.

*Actual Behavior:*

   - The reconnect button appears, but it results in a logout instead of
   reloading the session.
   - The authentication token is still stored in the browser, indicating
   the session should still be valid.

*Questions:*

   - Is there an implicit session invalidation happening elsewhere that
   causes the logout?
   - What’s the best approach to handle guacFatalPageError without forcing
   a logout?

*Environment:*

   - Guacamole version: 1.5.5
   - Browser: Chrome
   - OS: Linuxmint

Would appreciate any insights on this issue. Thanks!

Reply via email to