Skip to content

Commit

Permalink
set AntiCsrf on post construct
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed Sep 10, 2015
1 parent daf8ffd commit 2b1c48b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/AbstractAuraForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public function __construct()
public function postConstruct()
{
$this->init();
if ($this->antiCsrf instanceof AntiCsrfInterface) {
$this->setAntiCsrf($this->antiCsrf);
}
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/AbstractForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public function __construct()
public function postConstruct()
{
$this->init();
if ($this->antiCsrf instanceof AntiCsrfInterface) {
$this->setAntiCsrf($this->antiCsrf);
}
}

/**
Expand Down
7 changes: 6 additions & 1 deletion src/SetAntiCsrfTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@

trait SetAntiCsrfTrait
{
/**
* @var AntiCsrfInterface
*/
protected $antiCsrf;

/**
* @param AntiCsrfInterface $antiCsrf
*
* @\Ray\Di\Di\Inject
*/
public function injectAntiCsrf(AntiCsrfInterface $antiCsrf)
{
$this->setAntiCsrf($antiCsrf);
$this->antiCsrf = $antiCsrf;
}
}

0 comments on commit 2b1c48b

Please sign in to comment.