mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 23:49:55 +00:00
Merge branch 'master' into 2.3
Conflicts: lib/Cake/Controller/Component/SecurityComponent.php
This commit is contained in:
commit
4c98e39c1f
2 changed files with 20 additions and 0 deletions
|
@ -225,6 +225,10 @@ class SecurityComponent extends Component {
|
||||||
$controller->request->params['requested'] != 1
|
$controller->request->params['requested'] != 1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->_action == $this->blackHoleCallback) {
|
||||||
|
return $this->blackhole($controller, 'auth');
|
||||||
|
}
|
||||||
|
|
||||||
if (!in_array($this->_action, (array)$this->unlockedActions) && $isPost && $isNotRequestAction) {
|
if (!in_array($this->_action, (array)$this->unlockedActions) && $isPost && $isNotRequestAction) {
|
||||||
if ($this->validatePost && $this->_validatePost($controller) === false) {
|
if ($this->validatePost && $this->_validatePost($controller) === false) {
|
||||||
return $this->blackHole($controller, 'auth');
|
return $this->blackHole($controller, 'auth');
|
||||||
|
|
|
@ -194,6 +194,22 @@ class SecurityComponentTest extends CakeTestCase {
|
||||||
$this->Controller->Security->blackHole($this->Controller, 'csrf');
|
$this->Controller->Security->blackHole($this->Controller, 'csrf');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure that directly requesting the blackholeCallback as the controller
|
||||||
|
* action results in an exception.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testExceptionWhenActionIsBlackholeCallback() {
|
||||||
|
$this->Controller->request->addParams(array(
|
||||||
|
'controller' => 'posts',
|
||||||
|
'action' => 'fail'
|
||||||
|
));
|
||||||
|
$this->assertFalse($this->Controller->failed);
|
||||||
|
$this->Controller->Security->startup($this->Controller);
|
||||||
|
$this->assertTrue($this->Controller->failed, 'Request was blackholed.');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that initialize can set properties.
|
* test that initialize can set properties.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue