-
Notifications
You must be signed in to change notification settings - Fork 2k
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
_csrf is not defined when res.forbidden() is invoked #2566
Comments
Layout should not be used as a main file. Do you have enabled refer to: http://sailsjs.org/#/documentation/concepts/Security/CSRF.html |
It is set to true. If layout.ejs should not be used as main file, then what should? |
Try to put the form in an other .ejs and include it in your layout.
http://sailsjs.org/#/documentation/concepts/Views/Layouts.html |
I believe you are misunderstanding. I think I'm using layout.ejs properly. Perhaps "main" isn't the best word to describe how I'm using layout.ejs. It contains my header, footer, css and js includes, and other template stuff. My header has a sign in function that should be consistent with each page. Even if I don't have the form in the header, |
There is a test that use:
but I don't know why |
Maybe it's the ordering of the middleware? |
Any update about this issue guys? |
Is there any update on this? New info? Old questions? |
Thanks for posting, @boogerlad. I'm a repo bot-- nice to meet you! It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message. On the other hand, if you are still waiting on a patch, please:
Thanks so much for your help! |
In responses from res.forbidden(), the `_csrf` view local is not included (see balderdashy/sails#2566). We had a typeof check to prevent this from causing an error, but that typeof check was invalid.
In my layout.ejs file, I use the csrf token for signing in since I use the layout.ejs file as a "main" file where other ejs files get embedded into it as the actual content. Here's the full stack trace
The text was updated successfully, but these errors were encountered: