Skip to content

Commit

Permalink
Add replay variables to environment
Browse files Browse the repository at this point in the history
  • Loading branch information
David Vandemaele committed Aug 12, 2022
1 parent 0ce0945 commit 444a7ed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Skeleton/Core/Web/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,17 @@ public function display($template, $rewrite_html = true) {
* @param bool $rewrite_html
* @return string $rendered_template
*/
public function render($template, $rewrite_html = true) {
public function render($template, $rewrite_html = true) {
$csrf = Security\Csrf::get();

$this->add_environment('csrf_session_token_name', $csrf->get_session_token_name());
$this->add_environment('csrf_header_token_name', $csrf->get_header_token_name());
$this->add_environment('csrf_post_token_name', $csrf->get_post_token_name());
$this->add_environment('csrf_token', $csrf->get_session_token());

$replay = Security\Replay::get();
$this->add_environment('replay_session_tokens_name', $replay->get_session_tokens_name());
$this->add_environment('replay_header_token_name', $replay->get_header_token_name());
$this->add_environment('replay_post_token_name', $replay->get_post_token_name());

$output = $this->template->render($template);
$output = $csrf->inject($output);
Expand Down

0 comments on commit 444a7ed

Please sign in to comment.