- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的rails应用程序的所有页面的头部,都有以下2个meta标签:
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="027GUZBeEkmv..." />
authenticity_token
字段
<input type="hidden" name="authenticity_token" value="D5TddQruJppDD3..." />
<%= render 'shared/comment_form' %>
authenticity_token
,如果是的话如何验证它?
<%= form_for([@post, @comment], :html => { :onsubmit => "validateCommentForm(event)" }, remote:true) do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<div class="field">
<%= f.text_area :content, placeholder: "Add to the article. Make it be more" %>
</div>
<%= f.submit "Save", class: "btn btn-info" %>
<% end %>
<input type="hidden" name="authenticity_token" id="authenticity_token" value="ANYTHING" />
仍然可以发布信息并创建新记录...
最佳答案
对于您而言,我们有两种方法可以执行:
authenticity_token: true
<%= hidden_field_tag :authenticity_token, form_authenticity_token -%>
关于ruby-on-rails - Rails 4.如何向通过局部渲染的表单添加authenticity_token?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36000511/
我正在开发一个与 Rails 服务器通信的 Android 应用程序。我不想忽略 authenticity_token,但我也不认为要求它是正确的答案。可以采取哪些措施来保护我的 POST 请求? 最
什么情况下 form_authenticity_token 与 params[:authenticity_token] 不匹配? 我看到未经验证的请求进入我的应用程序,所以我覆盖了 form_tag
我在 Ruby 中进行了一些身份验证(来自 tutorial - 这使用 gem "bcrypt-ruby", :require => "bcrypt" 并且我需要将 authenticity_tok
我正在尝试将 Uploadify 与我的 Rails 3.1 应用程序一起使用,我已经完成了所有步骤(中间件、初始化程序、配置...等),我认为它们都运行良好,但一方面,我的真实性 token 正在过
我在用户管理 Controller 中有这样的更新方法 def update @user.update(user_permitted_params) redirect_to admin_use
如何从 Ruby on Rails 中的 authenticity_token 中删除 div? 谢谢。 最佳答案 您可以使用 form_authenticity_token 来解决这个问题,因为我相
我用这个把我的头发扯掉了。我在带有嵌套资源的 form_with 上得到了一个未经许可的参数。我正在使用 Rails 5.2.1 和 Ruby 2.5。 我不确定我到底哪里出了问题。我尝试了 site
我正在提交一个简单的 ajax 删除请求,如下所示: #invitation_actions =link_to "delete", invitation_path(invitation), :me
我是一名优秀的程序员,十分优秀!