Permalink
Browse files

Merge commit 'v1.3.1-iros'

  • Loading branch information...
2 parents fb1220a + cf51359 commit 5b404f0cf2bf6d7af9e8ee01b9d94f88647ea8aa @iros committed Aug 15, 2011
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/devise/controllers/internal_helpers.rb
@@ -95,8 +95,13 @@ def require_no_authentication
args = no_input.dup.push :scope => resource_name
if no_input.present? && warden.authenticate?(*args)
resource = warden.user(resource_name)
- flash[:alert] = I18n.t("devise.failure.already_authenticated")
- redirect_to after_sign_in_path_for(resource)
+
+ if (request.format == :json)
+ respond_with resource, :location => redirect_location(resource_name, resource)
+ else
+ flash[:alert] = I18n.t("devise.failure.already_authenticated")
+ redirect_to after_sign_in_path_for(resource)
+ end
end
end

0 comments on commit 5b404f0

Please sign in to comment.