components/openstack/horizon/patches/19-launchpad-1558917.patch
changeset 6856 356aeea98c39
equal deleted inserted replaced
6855:ea44e7e0ca98 6856:356aeea98c39
       
     1 Patch to prevent Horizon from redirecting to an non-existant logout
       
     2 page. Fixed in upstream via Launchpad bug 1558917 and changeset
       
     3 9399680106b4448c975b87a8b93f2188157a42ce.
       
     4 
       
     5 commit 9399680106b4448c975b87a8b93f2188157a42ce
       
     6 Author: Kenji Ishii <[email protected]>
       
     7 Date:   Fri Mar 18 14:37:13 2016 +0900
       
     8 
       
     9     Fix the issue which redirect to Not Found page
       
    10     
       
    11     If a session is timeout and then a user request ajax request,
       
    12     Horizon redirect to Not found page because the url is incorrect.
       
    13     This patch fix it in the correct url.
       
    14     
       
    15     Change-Id: I25b9e07b4f97594d05b0cdae931af9f142a18168
       
    16     Closes-bug: #1558917
       
    17 
       
    18 diff --git a/horizon/static/framework/framework.module.js b/horizon/static/framework/framework.module.js
       
    19 index 7a06bb0..fd6ba43 100644
       
    20 --- a/horizon/static/framework/framework.module.js
       
    21 +++ b/horizon/static/framework/framework.module.js
       
    22 @@ -64,7 +64,8 @@
       
    23        return {
       
    24          responseError: function (error) {
       
    25            if (error.status === 401) {
       
    26 -            $windowProvider.$get().location.replace('/auth/logout');
       
    27 +            var $window = $windowProvider.$get();
       
    28 +            $window.location.replace($window.WEBROOT + 'auth/logout');
       
    29            }
       
    30            return $q.reject(error);
       
    31          }
       
    32 diff --git a/horizon/static/framework/framework.module.spec.js b/horizon/static/framework/framework.module.spec.js
       
    33 index d12f76a..2028cd2 100644
       
    34 --- a/horizon/static/framework/framework.module.spec.js
       
    35 +++ b/horizon/static/framework/framework.module.spec.js
       
    36 @@ -36,11 +36,11 @@
       
    37  
       
    38      describe('when unauthorized', function() {
       
    39        it('should redirect to /auth/logout', inject(function($http, $httpBackend, $window) {
       
    40 -
       
    41 +        $window.WEBROOT = '/dashboard/';
       
    42          $httpBackend.when('GET', '/api').respond(401, '');
       
    43  
       
    44          $http.get('/api').error(function() {
       
    45 -          expect($window.location.replace).toHaveBeenCalledWith('/auth/logout');
       
    46 +          expect($window.location.replace).toHaveBeenCalledWith('/dashboard/auth/logout');
       
    47          });
       
    48          $httpBackend.flush();
       
    49        }));