Selamat siang gan,
Minta bantuanya soal Yii Framework versi 1. Disini saya meng-aktifkan CSRF Validation. Tapi pas saya coba login (form submit dengan method post). Dia malah keluar error :
“The CSRF token could not be verified.”
Padahal sudah saya cek di view page source ada input hidden untuk token nya. jadi bingung. mohon bantuannya. Terimakasih banyak.
CATATAN :
-
config/main.php
‘request’=>array(
‘enableCookieValidation’=>true,
‘enableCsrfValidation’=>true,
‘csrfTokenName’=>‘simasdasecuretoken’,
) -
form login html
<?php echo CHtml::form(array('site/auth')); ?>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input type="text" name="LoginForm[username]" placeholder="username" class="form-control" autocomplete="off">
</div><div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
<input type="password" name="LoginForm[password]" placeholder="password" class="form-control" autocomplete="off">
</div>
<!-- <div class="checkbox i-checks m-t-md">
<label>
<input type="checkbox" name="LoginForm[rememberMe]" value="1"><i></i> Remember me
</label>
</div> -->
<button type="submit" class="btn btn-theme btn-fill btn-block" style="margin-top: 20px;">LOGIN</button>
<?php echo CHtml::endForm(); ?>
-View page source dari form login