我在Rails 2.3.9中得到这个错误,但在2.3.8中没有。我没有改变任何代码。我错过了什么吗?SessionsController中的ActionController :: InvalidAuthenticityToken#创建错误
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 => "[email protected]$$", :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>
伟大工程。谢谢:) – 2010-09-20 01:14:10