3
我正在使用rails json webservices。我使用warden進行身份驗證,它使用html格式正常工作,但在json中它不起作用。因爲傳入的參數在config/intializers/wrden.rb文件中不起作用。以下是代碼在監督json參數不起作用
config/intializers/warden。 RB
def authenticate!
Rails.logger.info '!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
Rails.logger.info params['emailID']
user = User.find_by_emailID(params['emailID'])
if user && user.authenticate(params['password'])
success! user
else
fail "Invalid email or password"
end
end
這裏是這個
Parameters: {"emailID"=>"[email protected]", "password"=>"123456", "session"=>{"emailID"=>"[email protected]", "password"=>"123456"}}
(0.2ms) BEGIN
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
nil
User Load (12.2ms) SELECT "users".* FROM "users" WHERE "users"."emailID" IS **NULL** LIMIT 1
(0.3ms) COMMIT
Completed in 276ms
遇到同樣的問題 – rpearce