Skip to content

Commit

Permalink
Sign cookies Codeception#4656
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Dec 12, 2017
1 parent 416afd8 commit e604149
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Codeception/Module/Yii2.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,4 +679,13 @@ private function defineConstants()
defined('YII_ENV') or define('YII_ENV', 'test');
defined('YII_ENABLE_ERROR_HANDLER') or define('YII_ENABLE_ERROR_HANDLER', false);
}

public function setCookie($name, $val, array $params = [])
{
// Sign the cookie.
if ($this->app->request->enableCookieValidation) {
$val = $this->app->security->hashData(serialize([$name, $val]), $this->app->request->cookieValidationKey);
}
parent::setCookie($name, $val, $params);
}
}

0 comments on commit e604149

Please sign in to comment.