Kod
<?php
class LoginForm extends sfForm {
public function configure()
{
$this->setWidgets(array(
'username' => new sfWidgetFormInput(),
'password' => new sfWidgetFormInput(array('type' => 'password')),
'remember' => new sfWidgetFormInputCheckbox(),
));
$this->setValidators(array(
'username' => new sfValidatorString(),
'password' => new sfValidatorString(),
'remember' => new sfValidatorBoolean(),
));
$this->validatorSchema->setPostValidator(new sfGuardValidatorUser());
$this->widgetSchema->setNameFormat('signin[%s]');
}
}
?>
class LoginForm extends sfForm {
public function configure()
{
$this->setWidgets(array(
'username' => new sfWidgetFormInput(),
'password' => new sfWidgetFormInput(array('type' => 'password')),
'remember' => new sfWidgetFormInputCheckbox(),
));
$this->setValidators(array(
'username' => new sfValidatorString(),
'password' => new sfValidatorString(),
'remember' => new sfValidatorBoolean(),
));
$this->validatorSchema->setPostValidator(new sfGuardValidatorUser());
$this->widgetSchema->setNameFormat('signin[%s]');
}
}
?>
W module dodałem:
Kod
$this->loginForm = new LoginForm();
template:
Kod
<form action="<?php echo url_for('@sf_guard_signin') ?>" method="post">
<table>
<?php echo $loginForm ?>
</table>
<input type="submit" value="sign in" />
</form>
<table>
<?php echo $loginForm ?>
</table>
<input type="submit" value="sign in" />
</form>
I wszystko ładnie się wyświetla jednak po wpisaniu danych wyświetla się błąd:
Kod
csrf token: CSRF attack detected.
Jaki atak wykryty, nie kumam tego...Jak rozwiązać mój problem ?
P.S -> oczywiście po wejściu bezpośrednio /login -> logowanie działa bez problemu