More information about this topic
Reset database
 | 
enableCsrfValidation


Following is the html generated after csrfenabled in Yii's config :

<form action="/index.php?r=SecurityModule/cookie/csrf" method="post">
<input type="text" value="" name="username" id="username" />
<input type="submit" name="yt1" value="Send" />
</form>

protected/modules/SecurityModule/views/cookie/csrf.php


echo CHtml::beginForm();
echo CHtml::textField('username');
echo CHtml::submitButton('Send');
echo CHtml::endForm();

echo "<br/><br/>Following is the html generated after csrfenabled in Yii's config : ";
echo "<br/><br/>";
echo CHtml::encode(CHtml::beginForm());
echo "<br/>";
echo CHtml::encode(CHtml::textField('username'));
echo "<br/>";
echo CHtml::encode(CHtml::submitButton('Send'));
echo "<br/>";
echo CHtml::encode(CHtml::endForm());

protected/config/development.php

			'request'=>array(
				'enableCsrfValidation'=>true,
			), //end of request
Fork me on GitHub