浏览代码

HUE-5517 [core] Better logout and idle session timeouts messages

Romain Rigaux 9 年之前
父节点
当前提交
e8ca96f5ae

+ 7 - 20
desktop/core/src/desktop/templates/common_footer.mako

@@ -52,30 +52,17 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
     // global catch for ajax calls after the user has logged out
     var isLoginRequired = false;
     $(document).ajaxComplete(function (event, xhr, settings) {
-      var whiteListURLs = [
-        'filebrowser/copy?next=',
-        'filebrowser/move?next=',
-        'filebrowser/touch?next=',
-        'filebrowser/mkdir?next=',
-        'filebrowser/rmtree',
-        'filebrowser/chown?next=',
-        'filebrowser/chmod?next=',
-        'filebrowser/rename?next=',
-        'filebrowser/trash',
-      ];
-      var whiteListed = false;
-      whiteListURLs.forEach(function(url){
-        if (settings.url.indexOf(url) > -1){
-          whiteListed = true;
-        }
-      });
-      if ((xhr.responseText === '/* login required */' || (xhr.status === 403 && !whiteListed)) && !isLoginRequired) {
-        isLoginRequired = true;
+      if (xhr.responseText === '/* login required */') {
+        isAutoLogout = settings.url == '/desktop/debug/is_idle';
+
+        // if isAutoLogout --> auto-logout
+        // else logged-out (but could we use a regular modal without any white, like the sample popup for example?)
+
         $('.blurred').removeClass('blurred');
         if ($('#login-modal').length > 0 && $('#login-modal').is(':hidden')) {
           $('#login-modal .link-message').hide();
           if (xhr.status === 403) {
-            $('#login-modal .wrong-token').show();
+            $('#login-modal .auto-logged-out').show();
             $('#login-modal').modal('show');
           }
           else {

+ 3 - 3
desktop/core/src/desktop/templates/login_modal.mako

@@ -33,10 +33,10 @@
         <br/>
         <a id="reload" class="pointer">
         <span class="logged-out link-message" style="display: none">
-          ${ _('Reload this page to sign in again') }
+          ${ _('Your current action requires to reload this page to sign in again') }
         </span>
-        <span class="wrong-token link-message" style="display: none">
-          ${ _('Please reload this page') }
+        <span class="auto-logged-out link-message" style="display: none">
+          ${ _('We did not hear from you for about %s and for security reason Hue logged you out. Please reload this page to continue') % conf.AUTH.IDLE_SESSION_TIMEOUT.get() }
         </span>
         </a>
       </h4>