-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to implement CSRF tokens ? #4
Comments
My current workaround is to introduce new variable called csrfToken. my admin.php where the GridView is defined:
In EEditableColumn.php
In eeditable.js,
That's what I have been done to make it work. But, I hope you can find better and more simple solution. Cheers, Daniel |
thank u very much. reading your post carefully. |
Your solution is nicely implemented. Looking ahead in the base-base class: http://www.yiiframework.com/doc/api/1.1/CGridColumn#htmlOptions-detail you'll find the htmlOptions attribute, using that attribute you can skeep the code change at EEditableColumn by simply providing the token in:
the next change required is that made by you in the assets/eeditable.js:
maybe later i can implement options available for this ajax call, |
Googling on this topic, there is a suggestion to add a CActiveForm to enclose the input and in ajax call we only need to serialize the form. Hence, if we enable csrf, the CActiveForm will add the csrf token into a hidden field. What do you think? |
When we enable csrf, the error will appear "The CSRF token could not be verified". Where we can add the parameter for csrf?
The text was updated successfully, but these errors were encountered: