我在Rails 2.3.9中得到这个错误,但在2.3.8中没有。我没有更改任何代码。我错过什么了吗?
ActionController::InvalidAuthenticityToken in SessionsController#create ActionController::InvalidAuthenticityToken
谢谢)
以下是添加的详细信息。
Request
Parameters:
{"commit"=>"Login",
"authenticity_token"=>"A9A4+sCsA/81FFoXJEUNziQYhgQ38pceGN2i7MUQbQY=",
"password"=>"r3dp0rt"}
这是应用程序控制器中的代码
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery :secret => "r3dp0rtP@$$", :digest => "MD5" # See ActionController::RequestForgeryProtection for details
这是我的会话创建控制器的代码
def create
session[:password] = params[:password]
flash[:notice] = "Sucessfully logged in"
redirect_to "/login"
end
最后,这是我简单登录视图中的代码
<div id="placeholder">
<% form_tag :action => "create" do %>
<p>
<%= label_tag "This will enable administrative features for the site." %><br>
<%= password_field_tag "password" %>
</p>
<br>
<p>
<%= submit_tag "Login" %>
</p>
<% end %>
</div>