#367 fixed a csrf bug since 2014

This commit is contained in:
尘缘 2016-10-19 11:05:26 +08:00
parent 80df5b7735
commit fe99c1cbec
3 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,7 @@ class StatusController extends AbstractServerController {
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setCSRFKey('status');
$this->setActions(array('index', 'saveLayout'), 'index');
}

View File

@ -1,4 +1,5 @@
<div class="tab-content">
<input type="hidden" name="saveLayout_csrf" value="{{ csrf_token(csrf_key|default('')) }}" />
<div id="flow-layout" class="tab-pane {{ block_layout_active }}">
<div class="entity-container">
{% for server in servers_offline %}

View File

@ -135,6 +135,7 @@ function psm_xhr(mod, params, method, on_complete, options) {
function psm_saveLayout(layout) {
var params = {
action: 'saveLayout',
csrf: $("input[name=saveLayout_csrf]").val(),
layout: layout
};
psm_xhr('server_status', params, 'POST');