Fix horizon VM launch

Moving the cookie customization to the platform horizon, and
manually setting the new cookie to be used by our angularJS
FM client.  The change is not needed by the sysinv client since we are
able to embed the csrf token in the django template, which isn't
possible with the pure angular FM panels.

Change-Id: Iceebf7028325256b6793deb296d32e9a9f5fba21
Signed-off-by: Tyler Smith <tyler.smith@windriver.com>
Closes-Bug: 1813661
This commit is contained in:
Tyler Smith 2019-02-07 11:08:29 -05:00
parent 43e07f799c
commit c798c0d493
3 changed files with 10 additions and 5 deletions

View File

@ -1,2 +1,2 @@
SRC_DIR="starlingx-dashboard"
TIS_PATCH_VER=27
TIS_PATCH_VER=28

View File

@ -60,6 +60,14 @@ try:
except Exception:
pass
# Change session and CSRF cookie names to prevent login conflict with
# containerized horizon.
# NOTE: These settings break upstream angularJS forms such as the launch
# instance wizard. If this plugin is to be used in a standard horizon
# deployment these settings must be overwritten to their default values.
CSRF_COOKIE_NAME = 'platformcsrftoken'
SESSION_COOKIE_NAME = 'platformsessionid'
# check if it is in distributed cloud
DC_MODE = False
if distributed_cloud_role and distributed_cloud_role in ['systemcontroller',

View File

@ -30,10 +30,7 @@
updateEventSuppression: updateEventSuppression
};
var csrf_token = $('input[name=csrfmiddlewaretoken]').val();
$http.defaults.headers.post['X-CSRFToken'] = csrf_token;
$http.defaults.headers.common['X-CSRFToken'] = csrf_token;
$http.defaults.headers.put['X-CSRFToken'] = csrf_token;
$http.defaults.xsrfCookieName = 'platformcsrftoken';
return service;