sessions/new also responds to xml and json now

This commit is contained in:
José Valim
2011-04-18 09:56:24 +02:00
parent 2cfa58b433
commit 4a4dcb30ef
3 changed files with 21 additions and 8 deletions

View File

@@ -4,8 +4,9 @@ class Devise::SessionsController < ApplicationController
# GET /resource/sign_in
def new
clean_up_passwords(build_resource)
render_with_scope :new
resource = build_resource
clean_up_passwords(resource)
respond_with_navigational(resource, stub_options(resource)){ render_with_scope :new }
end
# POST /resource/sign_in
@@ -33,4 +34,12 @@ class Devise::SessionsController < ApplicationController
end
end
end
end
protected
def stub_options(resource)
hash = { :only => resource_class.authentication_keys }
hash[:methods] = [:password] if resource.respond_to?(:password)
hash
end
end