Jade equivalent for csrf token in Sails

From the examples, using the default ejs mechanism, the hidden input needed to protect csrf is:

<input type="hidden" name="_csrf" value="<%= _csrf %>" />

What is the jade equivalent? It:

input(type="hidden", name="_csrf", value='#{_csrf}')

Thank.


EDIT: I tried both value='#{_csrf}', and value=#{_csrf}, and I'm sure they are not correct, as they do not display the correct csrf token.

+4
source share
1 answer

Try:

input(type="hidden", name="_csrf", value=_csrf)

This should print the token for you.

+4
source

Source: https://habr.com/ru/post/1530907/


All Articles