Replies: 3 comments 1 reply
-
This does work in v4. But can't remember, how I did it before, sorry (in the meantime, I've implemented another approach for CSRF check). |
Beta Was this translation helpful? Give feedback.
-
I'am having the similar problem - please help! |
Beta Was this translation helpful? Give feedback.
-
An older project (but on Phalcon 4 already) uses something like this without problems:
EDIT: While writing this, I see that you use |
Beta Was this translation helpful? Give feedback.
-
Hi, I've had working csrf validation in my app, which had been taken from Vokuro sample app.
After upgrade to phalcon 4.0 I've done all necessary changes, and everything works fine except for csrf validation.
Here is my login form's csrf part:
Here is form's volt template part:
If I try output values of security.getToken from form and from template, they are the same, but Validator always fails.
I've tried different approaches, e.g. remove
$csrf->clear();
add$csrf->setDefault($this->security->getToken())
to login form's code.I've tried new approach from documentation, wasn't able to get it work as well.
Namely:
{{ form.render(security.getTokenKey(), ['value': security.getToken()]) }}
in form template
with
in session controller. And just element for csrf without validation on form.
Check token always returns null.
Could someone explain to me how do we validate csrf these days?
(Preferably with form validation if this even possible on 4th Phalcon)
Beta Was this translation helpful? Give feedback.
All reactions