|
|
@ -33,9 +33,6 @@ angular.module('portainer', [
|
|
|
|
.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', function ($stateProvider, $urlRouterProvider, $httpProvider) {
|
|
|
|
.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', function ($stateProvider, $urlRouterProvider, $httpProvider) {
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
$httpProvider.defaults.xsrfCookieName = 'csrfToken';
|
|
|
|
|
|
|
|
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$urlRouterProvider.otherwise('/');
|
|
|
|
$urlRouterProvider.otherwise('/');
|
|
|
|
|
|
|
|
|
|
|
|
$stateProvider
|
|
|
|
$stateProvider
|
|
|
@ -161,6 +158,8 @@ angular.module('portainer', [
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// The Docker API likes to return plaintext errors, this catches them and disp
|
|
|
|
// The Docker API likes to return plaintext errors, this catches them and disp
|
|
|
|
|
|
|
|
// $httpProvider.defaults.xsrfCookieName = 'csrfToken';
|
|
|
|
|
|
|
|
// $httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token';
|
|
|
|
$httpProvider.interceptors.push(function() {
|
|
|
|
$httpProvider.interceptors.push(function() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
'response': function(response) {
|
|
|
|
'response': function(response) {
|
|
|
@ -172,10 +171,11 @@ angular.module('portainer', [
|
|
|
|
time: 10000
|
|
|
|
time: 10000
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var csrfToken = response.headers('X-Csrf-Token');
|
|
|
|
// CSRF protection is disabled for the moment
|
|
|
|
if (csrfToken) {
|
|
|
|
// var csrfToken = response.headers('X-Csrf-Token');
|
|
|
|
document.cookie = 'csrfToken=' + csrfToken;
|
|
|
|
// if (csrfToken) {
|
|
|
|
}
|
|
|
|
// document.cookie = 'csrfToken=' + csrfToken;
|
|
|
|
|
|
|
|
// }
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|