Created
April 27, 2016 13:50
-
-
Save jlamim/4afa04ad2e83a1ac6a23ba963b59c7ab to your computer and use it in GitHub Desktop.
Reforçando a segurança com CSRF - Gerando o token no controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Gera o name e o hash para o campo hidden | |
$data['csrf'] = array( | |
'name' => $this->security->get_csrf_token_name(), | |
'hash' => $this->security->get_csrf_hash() | |
); | |
// Passa os valores para a view | |
$this->load->view('view', $data); | |
?> | |
// View recuperando os tokens | |
<input type="hidden" name="<?=$csrf['name'];?>" value="<?=$csrf['hash'];?>" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment