FOSUserBundle icon indicating copy to clipboard operation
FOSUserBundle copied to clipboard

Registration CSRF intention

Open raphaotten opened this issue 13 years ago • 1 comments

Hi all,

I want to render the registration form on every page if the user is not logged in. Therefore I print it manually. Unfortunately I get the invalid CSRF-Token message on submit...

I use

<input type="hidden" id="fos_user_registration_form__token" name="fos_user_registration_form[_token]" value="{{csrf_token('registration')}}">

in the form. 'registration' should be the right intention (as per RegistrationFormType.php), isn't it?

Thanks!

raphaotten avatar Jan 19 '13 20:01 raphaotten

It was my fault. In the overriden RegistrationFormType I didn't set the intention in the setDefaults method. Now it works :+1:

raphaotten avatar Jan 21 '13 13:01 raphaotten