Answer the question
In order to leave comments, you need to log in
Who faced the crooked csrf token generation module in symfony 5?
Listen explain how to live with it?
I set up authorization on the site according to this instruction
I made such a login form
class LoginType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('email',null,array('label' => false,'attr' => ['class' => 'register-form-input','autocomplete' => 'off']));
$builder->add('password',PasswordType::class,array('label' => false,'attr' => ['class' => 'register-form-input','autocomplete' => 'off']));
$builder->add('captcha', CaptchaType::class,array('label' => false,'attr' => ['class' => 'register-form-input','autocomplete' => 'off']));
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
// Configure your form options here
]);
}
}
{{ form_start(login_form) }}
<b>Email:</b><br />
{{ form_row(login_form.email) }}
<b>Password:</b><br />
{{ form_row(login_form.password) }}
<b>Код с картинки:</b><br />
{{ form_row(login_form.captcha) }}
<div class="text-center"><button type="submit" class="site-btn">Войти</button></div>
{{ form_row(login_form._token) }}
{{ form_end(login_form) }}
<input type="hidden" id="login__token" name="login[_token]" value="ZtVwBzXtPbbnZp-5D4RysR7eDDt1z3Tr5WvBCv7C1VU" /></form>
{{ form_row(login_form._token) }}
<input type="hidden" name="_csrf_token"
value="{{ csrf_token('authenticate') }}"
>
{{ form_end(login_form) }}
<input type="hidden" name="_csrf_token"
value="Xtnmxi4Pn_N95067wjxYEMh3t7vhf4FiPJCxYNUnWqA"
>
<input type="hidden" id="login__token" name="login[_token]" value="ZtVwBzXtPbbnZp-5D4RysR7eDDt1z3Tr5WvBCv7C1VU" /></form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question