0
class CustomFailureApp < Devise::FailureApp
# You need to override respond to eliminate recall
def respond
  if http_auth?
    http_auth
  else
    if request.format == "application/json"
      self.status = 401 
      self.content_type = "json"
      self.headers['WWW-Authenticate']="Please Confirm Your Account To Continue"
      self.response_body = {error: I18n.t("devise.failure.inactive")}.to_json
    else
      redirect          
    end
  end
end
end

每当用户未确认时 spree_auth_devise 以未经授权的方式响应,由我的自定义失败应用程序处理,但 ios 应用程序收到的响应对象为空。ios 应用程序正在使用 AFNetworking 并更新为 latestmaster 我无法理解我做错了什么。

4

1 回答 1

0

我发现这段代码没有问题,相反 ios 响应处理程序有问题。

于 2015-04-15T11:37:29.147 回答