mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Don't require explicit scope in authenticate router extension
This commit is contained in:
parent
ff90d9da9c
commit
d38341b5e0
2 changed files with 7 additions and 3 deletions
|
@ -205,11 +205,15 @@ module ActionDispatch::Routing
|
|||
|
||||
# Allow you to add authentication request from the router:
|
||||
#
|
||||
# authenticate(:user) do
|
||||
# authenticate do
|
||||
# resources :post
|
||||
# end
|
||||
#
|
||||
def authenticate(scope)
|
||||
# authenticate(:admin) do
|
||||
# resources :users
|
||||
# end
|
||||
#
|
||||
def authenticate(scope=nil)
|
||||
constraint = lambda do |request|
|
||||
request.env["warden"].authenticate!(:scope => scope)
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ Rails.application.routes.draw do
|
|||
get :expire, :on => :member
|
||||
get :accept, :on => :member
|
||||
|
||||
authenticate :user do
|
||||
authenticate do
|
||||
post :exhibit, :on => :member
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue