设计认证有时会响应302而不是201

时间:2013-03-04 17:37:07

标签: ruby-on-rails login devise http-response-codes

即使用户已登录,我也略微修改了Devise的会话控制器,使其响应201代码:

class SessionsController < Devise::SessionsController
  # POST /resource/sign_in
  def create
    resource = warden.authenticate!(auth_options)
    set_flash_message(:notice, :signed_in) if is_navigational_format?
    sign_in(resource_name, resource)
    resource[:is_admin] = resource.is_admin?
    #respond_with resource, :location => after_sign_in_path_for(resource)
    render :status => :created, :location => '/#/editor', :json => resource
  end
end

(最后一行替换了注释的那一行),但它继续使用302状态代码而不是201来响应身份验证JSON。我做错了什么?

0 个答案:

没有答案