Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge commit 'v1.3.1-iros'

  • Loading branch information...
commit 5b404f0cf2bf6d7af9e8ee01b9d94f88647ea8aa 2 parents fb1220a + cf51359
@iros authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/devise/controllers/internal_helpers.rb
View
9 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
Please sign in to comment.
Something went wrong with that request. Please try again.