Instead of depending on mapping.controller[:session], make it explicit when we allow auth from params.

This commit is contained in:
José Valim 2011-09-14 16:52:07 -07:00
parent 0b9a95e294
commit 335d36088f
2 changed files with 2 additions and 11 deletions

View File

@ -1,5 +1,6 @@
class Devise::SessionsController < ApplicationController
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
before_filter :allow_params_authentication!, :only => :create
include Devise::Controllers::InternalHelpers
# GET /resource/sign_in

View File

@ -85,17 +85,7 @@ module Devise
# By default, a request is valid if the controller is allowed and the VERB is POST.
def valid_request?
valid_controller? && valid_verb?
end
# Check if the controller is the one registered for authentication.
def valid_controller?
mapping.controllers[:sessions] == params[:controller]
end
# Check if it was a POST request.
def valid_verb?
request.post?
env["devise.allow_params_authentication"]
end
# If the request is valid, finally check if params_auth_hash returns a hash.