bug of _csrf_token requied in Symfony

Some times, when you work with symfony forms in this way:

<form action="<?php echo url_for('@sf_guard_signin') ?>" method="post">

<?php echo $form['username']->renderLabel(); ?>
<?php echo $form['username']; ?>

<?php echo $form['password']->renderLabel(); ?>
<?php echo $form['password']; ?>

<label class="checkput">
<?php echo $form['remember']?>
<?php echo $form['remember']->renderLabel(); ?>
</label>

<input type="submit" value="<?php echo __('Envoyer', null, 'sf_guard') ?>" />
</form>

It will return _csrf_token is requied.

Now what you need to do is just add:

<?php echo $form['_csrf_token']; ?>

posted @ 2011-08-31 22:40  Lux.Y  阅读(455)  评论(0)    收藏  举报