Returning WWW-authenticate on ajaxs calls depends only on Devise.http_authenticatable_on_xhr config

This commit is contained in:
Santiago Pastorino
2010-08-31 23:44:19 +08:00
committed by José Valim
parent bf122d8fea
commit 5fb5efbd42
2 changed files with 14 additions and 1 deletions

View File

@@ -68,7 +68,11 @@ module Devise
end
def http_auth?
!Devise.navigational_formats.include?(request.format.to_sym) || (Devise.http_authenticatable_on_xhr && request.xhr?)
if request.xhr?
Devise.http_authenticatable_on_xhr
else
!Devise.navigational_formats.include?(request.format.to_sym)
end
end
def http_auth_body