Skip to content

Commit

Permalink
Add csrf token on routes.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <[email protected]>
  • Loading branch information
crynobone committed Nov 13, 2014
1 parent 9b50320 commit 4c7d61f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Control/Routing/AclController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public function __construct(AclProcessor $processor)
protected function setupFilters()
{
$this->beforeFilter('control.manage:acl');
$this->beforeFilter('orchestra.csrf', array(
'only' => array('postIndex', 'getSync'),
));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/Control/Routing/RolesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public function __construct(RoleProcessor $processor)
protected function setupFilters()
{
$this->beforeFilter('control.manage:roles');
$this->beforeFilter('orchestra.csrf', array(
'on' => array('post', 'put', 'delete'),
));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/Control/Routing/ThemesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function __construct(ThemeProcessor $processor)
protected function setupFilters()
{
$this->beforeFilter('control.manage:acl');
$this->beforeFilter('orchestra.csrf', array(
'only' => array('getActivate'),
));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/views/acl/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<div class="row">
<div class="twelve columns">
<button type="submit" class="btn btn-primary">{{ trans('orchestra/foundation::label.submit') }}</button>
<a href="{{ resources("control.acl/sync/{$id}") }}" class="btn btn-link">
<a href="{{ resources("control.acl/sync/{$id}", array('csrf' => true)) }}" class="btn btn-link">
{{ trans('orchestra/control::label.sync-roles') }}
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/themes/_list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{ trans('orchestra/control::label.themes.current') }}
</button>
@else
<a href="{{ resources("control.themes/activate/{$type}/{$id}") }}" class="btn btn-block btn-primary">
<a href="{{ resources("control.themes/activate/{$type}/{$id}", array('csrf' => true)) }}" class="btn btn-block btn-primary">
{{ trans('orchestra/control::label.themes.activate') }}
</a>
@endif
Expand Down

0 comments on commit 4c7d61f

Please sign in to comment.