mirror of
https://github.com/portainer/portainer.git
synced 2025-08-06 06:15:22 +02:00
Fix csrf, send tokens back in header, pass token instead of cookie back to server.
This commit is contained in:
parent
7267516363
commit
0244bc7317
2 changed files with 9 additions and 20 deletions
12
app/app.js
12
app/app.js
|
@ -26,7 +26,7 @@ angular.module('dockerui', [
|
|||
.config(['$routeProvider', '$httpProvider', function ($routeProvider, $httpProvider) {
|
||||
'use strict';
|
||||
|
||||
$httpProvider.defaults.xsrfCookieName = '_gorilla_csrf';
|
||||
$httpProvider.defaults.xsrfCookieName = 'csrfToken';
|
||||
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token';
|
||||
|
||||
$routeProvider.when('/', {
|
||||
|
@ -83,13 +83,11 @@ angular.module('dockerui', [
|
|||
time: 10000
|
||||
});
|
||||
}
|
||||
console.log('response', response);
|
||||
var csrfToken = response.headers('X-Csrf-Token');
|
||||
if (csrfToken) {
|
||||
document.cookie = 'csrfToken=' + csrfToken;
|
||||
}
|
||||
return response;
|
||||
},
|
||||
request: function(config) {
|
||||
console.log(document.cookie);
|
||||
console.log('request', config);
|
||||
return config;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue