我在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