devise 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of devise might be problematic. Click here for more details.
- data/CHANGELOG.rdoc +12 -0
- data/README.rdoc +1 -1
- data/app/controllers/sessions_controller.rb +1 -7
- data/generators/devise/templates/README +5 -4
- data/generators/devise_install/templates/devise.rb +8 -1
- data/lib/devise.rb +22 -3
- data/lib/devise/controllers/filters.rb +16 -1
- data/lib/devise/controllers/helpers.rb +10 -4
- data/lib/devise/failure.rb +1 -1
- data/lib/devise/mapping.rb +45 -20
- data/lib/devise/rails/routes.rb +31 -16
- data/lib/devise/version.rb +1 -1
- data/test/controllers/filters_test.rb +13 -0
- data/test/controllers/helpers_test.rb +5 -1
- data/test/devise_test.rb +1 -1
- data/test/integration/authenticatable_test.rb +1 -1
- data/test/mapping_test.rb +33 -3
- data/test/rails_app/config/routes.rb +1 -1
- data/test/routes_test.rb +5 -1
- metadata +31 -31
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
== 0.4.2
|
2
|
+
|
3
|
+
* deprecations
|
4
|
+
* Renamed mail_sender to mailer_sender
|
5
|
+
|
6
|
+
* enhancements
|
7
|
+
* skip_before_filter added in Devise controllers
|
8
|
+
* Use home_or_root_path on require_no_authentication as well
|
9
|
+
* Added devise_controller?, useful to select or reject filters in ApplicationController
|
10
|
+
* Allow :path_prefix to be given to devise_for
|
11
|
+
* Allow default_url_options to be configured through devise (:path_prefix => "/:locale" is now supported)
|
12
|
+
|
1
13
|
== 0.4.1
|
2
14
|
|
3
15
|
* bug fix
|
data/README.rdoc
CHANGED
@@ -154,7 +154,7 @@ After signing in a user, confirming it's account or updating it's password, devi
|
|
154
154
|
You also need to setup default url options for the mailer, if you are using confirmable or recoverable. Here's is the configuration for development:
|
155
155
|
|
156
156
|
DeviseMailer.sender = "no-reply@yourapp.com"
|
157
|
-
|
157
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
158
158
|
|
159
159
|
== Tidying up
|
160
160
|
|
@@ -1,17 +1,11 @@
|
|
1
1
|
class SessionsController < ApplicationController
|
2
2
|
include Devise::Controllers::Helpers
|
3
3
|
|
4
|
-
# Maps the messages types that comes from warden to a flash type.
|
5
|
-
WARDEN_MESSAGES = {
|
6
|
-
:unauthenticated => :success,
|
7
|
-
:unconfirmed => :failure
|
8
|
-
}
|
9
|
-
|
10
4
|
before_filter :require_no_authentication, :only => [ :new, :create ]
|
11
5
|
|
12
6
|
# GET /resource/sign_in
|
13
7
|
def new
|
14
|
-
|
8
|
+
Devise::FLASH_MESSAGES.each do |message, type|
|
15
9
|
set_now_flash_message type, message if params.key?(message)
|
16
10
|
end
|
17
11
|
build_resource
|
@@ -7,12 +7,13 @@ Some setup you must do manually if you haven't yet:
|
|
7
7
|
|
8
8
|
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
9
9
|
|
10
|
-
It's a Rails required configuration.
|
11
|
-
In production it must be the actual host your application is deployed to.
|
10
|
+
It's a Rails required configuration. In production it must be the actual host your application is deployed to.
|
12
11
|
|
13
|
-
2. Setup default sender for mails.In config/environment.rb:
|
12
|
+
2. Setup default sender for mails. In config/environment.rb:
|
14
13
|
|
15
|
-
|
14
|
+
DeviseMailer.sender = "test@example.com"
|
15
|
+
|
16
|
+
You can also configure this value by running script/generate devise_install and setting config.mailer_sender,
|
16
17
|
|
17
18
|
3. Ensure you have defined root_url to *something* in your config/routes.rb:
|
18
19
|
|
@@ -16,7 +16,7 @@ Devise.setup do |config|
|
|
16
16
|
# config.remember_for = 2.weeks
|
17
17
|
|
18
18
|
# Configure the e-mail address which will be shown in DeviseMailer.
|
19
|
-
# config.
|
19
|
+
# config.mailer_sender = "foo.bar@yourapp.com"
|
20
20
|
|
21
21
|
# If you want to use other strategies, that are not (yet) supported by Devise,
|
22
22
|
# you can configure them inside the config.warden block. The example below
|
@@ -30,4 +30,11 @@ Devise.setup do |config|
|
|
30
30
|
# end
|
31
31
|
# manager.default_strategies.unshift :twitter_oauth
|
32
32
|
# end
|
33
|
+
|
34
|
+
# Configure default_url_options if you are using dynamic segments in :path_prefix
|
35
|
+
# for devise_for.
|
36
|
+
#
|
37
|
+
# config.default_url_options do
|
38
|
+
# { :locale => I18n.locale }
|
39
|
+
# end
|
33
40
|
end
|
data/lib/devise.rb
CHANGED
@@ -11,9 +11,19 @@ module Devise
|
|
11
11
|
STRATEGIES = [:rememberable, :authenticatable].freeze
|
12
12
|
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].freeze
|
13
13
|
|
14
|
+
# Maps the messages types that comes from warden to a flash type.
|
15
|
+
FLASH_MESSAGES = {
|
16
|
+
:unauthenticated => :success,
|
17
|
+
:unconfirmed => :failure
|
18
|
+
}
|
19
|
+
|
14
20
|
# Models configuration
|
15
21
|
mattr_accessor :pepper, :stretches, :remember_for, :confirm_within
|
16
22
|
|
23
|
+
# Mappings
|
24
|
+
mattr_accessor :mappings
|
25
|
+
self.mappings = {}
|
26
|
+
|
17
27
|
class << self
|
18
28
|
# Default way to setup Devise. Run script/generate devise_install to create
|
19
29
|
# a fresh initializer with all configuration values.
|
@@ -21,11 +31,16 @@ module Devise
|
|
21
31
|
yield self
|
22
32
|
end
|
23
33
|
|
34
|
+
def mail_sender=(value) #:nodoc:
|
35
|
+
ActiveSupport::Deprecation.warn "Devise.mail_sender= is deprecated, use Devise.mailer_sender instead"
|
36
|
+
DeviseMailer.sender = value
|
37
|
+
end
|
38
|
+
|
24
39
|
# Sets the sender in DeviseMailer.
|
25
|
-
def
|
40
|
+
def mailer_sender=(value)
|
26
41
|
DeviseMailer.sender = value
|
27
42
|
end
|
28
|
-
alias :sender= :
|
43
|
+
alias :sender= :mailer_sender=
|
29
44
|
|
30
45
|
# Sets warden configuration using a block that will be invoked on warden
|
31
46
|
# initialization.
|
@@ -42,6 +57,11 @@ module Devise
|
|
42
57
|
@warden_config = block
|
43
58
|
end
|
44
59
|
|
60
|
+
# Configure default url options to be used within Devise and ActionController.
|
61
|
+
def default_url_options(&block)
|
62
|
+
Devise::Mapping.metaclass.send :define_method, :default_url_options, &block
|
63
|
+
end
|
64
|
+
|
45
65
|
# A method used internally to setup warden manager from the Rails initialize
|
46
66
|
# block.
|
47
67
|
def configure_warden_manager(manager) #:nodoc:
|
@@ -56,5 +76,4 @@ module Devise
|
|
56
76
|
end
|
57
77
|
|
58
78
|
require 'devise/warden'
|
59
|
-
require 'devise/mapping'
|
60
79
|
require 'devise/rails'
|
@@ -6,8 +6,14 @@ module Devise
|
|
6
6
|
|
7
7
|
def self.included(base)
|
8
8
|
base.class_eval do
|
9
|
-
helper_method :warden, :signed_in?,
|
9
|
+
helper_method :warden, :signed_in?, :devise_controller?,
|
10
10
|
*Devise.mappings.keys.map { |m| [:"current_#{m}", :"#{m}_signed_in?"] }.flatten
|
11
|
+
|
12
|
+
# Use devise default_url_options. We have to declare it here to overwrite
|
13
|
+
# default definitions.
|
14
|
+
def default_url_options(options=nil)
|
15
|
+
Devise::Mapping.default_url_options
|
16
|
+
end
|
11
17
|
end
|
12
18
|
end
|
13
19
|
|
@@ -16,6 +22,15 @@ module Devise
|
|
16
22
|
request.env['warden']
|
17
23
|
end
|
18
24
|
|
25
|
+
# Return true if it's a devise_controller. false to all controllers unless
|
26
|
+
# the controllers defined inside devise. Useful if you want to apply a before
|
27
|
+
# filter to all controller, except the ones in devise:
|
28
|
+
#
|
29
|
+
# before_filter :my_filter, :unless => { |c| c.devise_controller? }
|
30
|
+
def devise_controller?
|
31
|
+
false
|
32
|
+
end
|
33
|
+
|
19
34
|
# Attempts to authenticate the given scope by running authentication hooks,
|
20
35
|
# but does not redirect in case of failures.
|
21
36
|
def authenticate(scope)
|
@@ -7,9 +7,10 @@ module Devise
|
|
7
7
|
|
8
8
|
def self.included(base)
|
9
9
|
base.class_eval do
|
10
|
-
helper_method :resource, :resource_name, :resource_class, :devise_mapping
|
11
|
-
hide_action :resource, :resource_name, :resource_class, :devise_mapping
|
10
|
+
helper_method :resource, :resource_name, :resource_class, :devise_mapping, :devise_controller?
|
11
|
+
hide_action :resource, :resource_name, :resource_class, :devise_mapping, :devise_controller?
|
12
12
|
|
13
|
+
skip_before_filter *Devise.mappings.keys.map { |m| :"authenticate_#{m}!" }
|
13
14
|
before_filter :is_devise_resource?
|
14
15
|
end
|
15
16
|
end
|
@@ -31,7 +32,12 @@ module Devise
|
|
31
32
|
|
32
33
|
# Attempt to find the mapped route for devise based on request path
|
33
34
|
def devise_mapping
|
34
|
-
@devise_mapping ||= Devise.
|
35
|
+
@devise_mapping ||= Devise::Mapping.find_by_path(request.path)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Overwrites devise_controller? to return true
|
39
|
+
def devise_controller?
|
40
|
+
true
|
35
41
|
end
|
36
42
|
|
37
43
|
protected
|
@@ -91,7 +97,7 @@ module Devise
|
|
91
97
|
# Example:
|
92
98
|
# before_filter :require_no_authentication, :only => :new
|
93
99
|
def require_no_authentication
|
94
|
-
redirect_to
|
100
|
+
redirect_to home_or_root_path if warden.authenticated?(resource_name)
|
95
101
|
end
|
96
102
|
|
97
103
|
# Sets the flash message with :key, using I18n. By default you are able
|
data/lib/devise/failure.rb
CHANGED
data/lib/devise/mapping.rb
CHANGED
@@ -22,13 +22,33 @@ module Devise
|
|
22
22
|
# # is the modules included in the class
|
23
23
|
#
|
24
24
|
class Mapping #:nodoc:
|
25
|
-
attr_reader :name, :as, :path_names
|
25
|
+
attr_reader :name, :as, :path_names, :path_prefix
|
26
|
+
|
27
|
+
# Loop through all mappings looking for a map that matches with the requested
|
28
|
+
# path (ie /users/sign_in). If a path prefix is given, it's taken into account.
|
29
|
+
def self.find_by_path(path)
|
30
|
+
Devise.mappings.each_value do |mapping|
|
31
|
+
route = path.split("/")[mapping.as_position]
|
32
|
+
return mapping if mapping.as == route.to_sym
|
33
|
+
end
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
37
|
+
# Default url options which can be used as prefix.
|
38
|
+
def self.default_url_options
|
39
|
+
{}
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize(name, options) #:nodoc:
|
43
|
+
options.assert_valid_keys(:class_name, :as, :path_names, :singular, :path_prefix)
|
26
44
|
|
27
|
-
def initialize(name, options)
|
28
45
|
@as = (options[:as] || name).to_sym
|
29
46
|
@klass = (options[:class_name] || name.to_s.classify).to_s
|
30
47
|
@name = (options[:singular] || name.to_s.singularize).to_sym
|
31
|
-
@path_names
|
48
|
+
@path_names = options[:path_names] || {}
|
49
|
+
@path_prefix = options[:path_prefix] || ""
|
50
|
+
@path_prefix << "/" unless @path_prefix[-1] == ?/
|
51
|
+
|
32
52
|
setup_path_names
|
33
53
|
end
|
34
54
|
|
@@ -50,6 +70,28 @@ module Devise
|
|
50
70
|
self.for.include?(CONTROLLERS[controller.to_sym])
|
51
71
|
end
|
52
72
|
|
73
|
+
# Return in which position in the path prefix devise should find the as mapping.
|
74
|
+
def as_position
|
75
|
+
self.path_prefix.count("/")
|
76
|
+
end
|
77
|
+
|
78
|
+
# Returns the raw path using path_prefix and as.
|
79
|
+
def raw_path
|
80
|
+
path_prefix + as.to_s
|
81
|
+
end
|
82
|
+
|
83
|
+
# Returns the parsed path. If you need meta information in your path_prefix,
|
84
|
+
# you should overwrite this method to use it. The only information supported
|
85
|
+
# by default is I18n.locale.
|
86
|
+
#
|
87
|
+
def parsed_path
|
88
|
+
returning raw_path do |path|
|
89
|
+
self.class.default_url_options.each do |key, value|
|
90
|
+
path.gsub!(key.inspect, value.to_s)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
53
95
|
# Create magic predicates for verifying what module is activated by this map.
|
54
96
|
# Example:
|
55
97
|
#
|
@@ -75,21 +117,4 @@ module Devise
|
|
75
117
|
end
|
76
118
|
end
|
77
119
|
end
|
78
|
-
|
79
|
-
mattr_accessor :mappings
|
80
|
-
self.mappings = {}
|
81
|
-
|
82
|
-
# Loop through all mappings looking for a map that matches with the requested
|
83
|
-
# path (ie /users/sign_in). The important part here is the key :users. If no
|
84
|
-
# map is found just returns nil.
|
85
|
-
def self.find_mapping_by_path(path)
|
86
|
-
route = path.split("/")[1]
|
87
|
-
return nil unless route
|
88
|
-
|
89
|
-
route = route.to_sym
|
90
|
-
mappings.each do |key, map|
|
91
|
-
return map if map.as == route.to_sym
|
92
|
-
end
|
93
|
-
nil
|
94
|
-
end
|
95
120
|
end
|
data/lib/devise/rails/routes.rb
CHANGED
@@ -59,36 +59,51 @@ module ActionController::Routing
|
|
59
59
|
# * :path_names => configure different path names to overwrite defaults :sign_in, :sign_out, :password and :confirmation.
|
60
60
|
#
|
61
61
|
# map.devise_for :users, :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification' }
|
62
|
+
#
|
63
|
+
# * :path_prefix => the path prefix to be used in all routes.
|
64
|
+
#
|
65
|
+
# map.devise_for :users, :path_prefix => "/:locale"
|
66
|
+
#
|
67
|
+
# If you are using a dynamic prefix, like :locale above, you need to configure default_url_options through Devise. You can do that in config/initializers/devise.rb or setting a Devise.default_url_options:
|
68
|
+
#
|
69
|
+
# Devise.default_url_options do
|
70
|
+
# { :locale => I18n.locale }
|
71
|
+
# end
|
72
|
+
#
|
62
73
|
def devise_for(*resources)
|
63
74
|
options = resources.extract_options!
|
64
75
|
|
65
76
|
resources.map!(&:to_sym)
|
66
|
-
options.assert_valid_keys(:class_name, :as, :path_names, :singular)
|
67
|
-
|
68
77
|
resources.each do |resource|
|
69
78
|
mapping = Devise::Mapping.new(resource, options)
|
70
79
|
Devise.mappings[mapping.name] = mapping
|
71
80
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
session.send(:"#{mapping.name}_session", mapping.path_names[:sign_in], :action => 'create', :conditions => { :method => :post })
|
76
|
-
session.send(:"destroy_#{mapping.name}_session", mapping.path_names[:sign_out], :action => 'destroy', :conditions => { :method => :get })
|
81
|
+
with_options(:path_prefix => mapping.raw_path, :name_prefix => "#{mapping.name}_") do |routes|
|
82
|
+
mapping.for.each do |strategy|
|
83
|
+
send(strategy, routes, mapping) if self.respond_to?(strategy, true)
|
77
84
|
end
|
78
85
|
end
|
86
|
+
end
|
87
|
+
end
|
79
88
|
|
80
|
-
|
81
|
-
if mapping.recoverable?
|
82
|
-
m.resource :password, :only => [:new, :create, :edit, :update], :as => mapping.path_names[:password]
|
83
|
-
end
|
89
|
+
protected
|
84
90
|
|
85
|
-
|
86
|
-
|
87
|
-
|
91
|
+
def authenticatable(routes, mapping)
|
92
|
+
routes.with_options(:controller => 'sessions', :name_prefix => nil) do |session|
|
93
|
+
session.send(:"new_#{mapping.name}_session", mapping.path_names[:sign_in], :action => 'new', :conditions => { :method => :get })
|
94
|
+
session.send(:"#{mapping.name}_session", mapping.path_names[:sign_in], :action => 'create', :conditions => { :method => :post })
|
95
|
+
session.send(:"destroy_#{mapping.name}_session", mapping.path_names[:sign_out], :action => 'destroy', :conditions => { :method => :get })
|
88
96
|
end
|
89
97
|
end
|
90
|
-
end
|
91
|
-
end
|
92
98
|
|
99
|
+
def recoverable(routes, mapping)
|
100
|
+
routes.resource :password, :only => [:new, :create, :edit, :update], :as => mapping.path_names[:password]
|
101
|
+
end
|
102
|
+
|
103
|
+
def confirmable(routes, mapping)
|
104
|
+
routes.resource :confirmation, :only => [:new, :create, :show], :as => mapping.path_names[:confirmation]
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
93
108
|
end
|
94
109
|
end
|
data/lib/devise/version.rb
CHANGED
@@ -87,4 +87,17 @@ class ControllerAuthenticableTest < ActionController::TestCase
|
|
87
87
|
@mock_warden.expects(:set_user).with(user = mock, :scope => :user).returns(true)
|
88
88
|
@controller.sign_in(:user, user)
|
89
89
|
end
|
90
|
+
|
91
|
+
test 'is not a devise controller' do
|
92
|
+
assert_not @controller.devise_controller?
|
93
|
+
end
|
94
|
+
|
95
|
+
test 'default url options are retrieved from devise' do
|
96
|
+
begin
|
97
|
+
Devise.default_url_options {{ :locale => I18n.locale }}
|
98
|
+
assert_equal({ :locale => :en }, @controller.send(:default_url_options))
|
99
|
+
ensure
|
100
|
+
Devise.default_url_options {{ }}
|
101
|
+
end
|
102
|
+
end
|
90
103
|
end
|
@@ -43,9 +43,13 @@ class HelpersTest < ActionController::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
test 'require no authentication tests current mapping' do
|
46
|
-
@controller.expects(:resource_name).returns(:user)
|
46
|
+
@controller.expects(:resource_name).returns(:user).twice
|
47
47
|
@mock_warden.expects(:authenticated?).with(:user).returns(true)
|
48
48
|
@controller.expects(:redirect_to).with(root_path)
|
49
49
|
@controller.send :require_no_authentication
|
50
50
|
end
|
51
|
+
|
52
|
+
test 'is a devise controller' do
|
53
|
+
assert @controller.devise_controller?
|
54
|
+
end
|
51
55
|
end
|
data/test/devise_test.rb
CHANGED
@@ -27,7 +27,7 @@ class DeviseTest < ActiveSupport::TestCase
|
|
27
27
|
test 'DeviseMailer.sender can be configured through Devise' do
|
28
28
|
swap DeviseMailer, :sender => "foo@bar" do
|
29
29
|
assert_equal "foo@bar", DeviseMailer.sender
|
30
|
-
Devise.
|
30
|
+
Devise.mailer_sender = "bar@foo"
|
31
31
|
assert_equal "bar@foo", DeviseMailer.sender
|
32
32
|
end
|
33
33
|
end
|
@@ -114,7 +114,7 @@ class AuthenticationTest < ActionController::IntegrationTest
|
|
114
114
|
get new_admin_session_path
|
115
115
|
|
116
116
|
assert_response :redirect
|
117
|
-
assert_redirected_to
|
117
|
+
assert_redirected_to admin_root_path
|
118
118
|
assert warden.authenticated?(:admin)
|
119
119
|
end
|
120
120
|
|
data/test/mapping_test.rb
CHANGED
@@ -31,12 +31,12 @@ class MappingTest < ActiveSupport::TestCase
|
|
31
31
|
end
|
32
32
|
|
33
33
|
test 'return mapping by path' do
|
34
|
-
assert_nil Devise.
|
35
|
-
assert_equal Devise.mappings[:user], Devise.
|
34
|
+
assert_nil Devise::Mapping.find_by_path("/foo/bar")
|
35
|
+
assert_equal Devise.mappings[:user], Devise::Mapping.find_by_path("/users/session")
|
36
36
|
end
|
37
37
|
|
38
38
|
test 'return mapping by customized path' do
|
39
|
-
assert_equal Devise.mappings[:admin], Devise.
|
39
|
+
assert_equal Devise.mappings[:admin], Devise::Mapping.find_by_path("/admin_area/session")
|
40
40
|
end
|
41
41
|
|
42
42
|
test 'return default path names' do
|
@@ -55,6 +55,36 @@ class MappingTest < ActiveSupport::TestCase
|
|
55
55
|
assert_equal 'verification', mapping.path_names[:confirmation]
|
56
56
|
end
|
57
57
|
|
58
|
+
test 'has an empty path as default path prefix' do
|
59
|
+
mapping = Devise.mappings[:account]
|
60
|
+
assert_equal '/', mapping.path_prefix
|
61
|
+
end
|
62
|
+
|
63
|
+
test 'allow path prefix to be configured' do
|
64
|
+
mapping = Devise.mappings[:manager]
|
65
|
+
assert_equal '/:locale/', mapping.path_prefix
|
66
|
+
end
|
67
|
+
|
68
|
+
test 'retrieve as from the proper position' do
|
69
|
+
assert_equal 1, Devise.mappings[:account].as_position
|
70
|
+
assert_equal 2, Devise.mappings[:manager].as_position
|
71
|
+
end
|
72
|
+
|
73
|
+
test 'raw path is returned' do
|
74
|
+
assert_equal '/account', Devise.mappings[:account].raw_path
|
75
|
+
assert_equal '/:locale/organizers', Devise.mappings[:manager].raw_path
|
76
|
+
end
|
77
|
+
|
78
|
+
test 'parsed path is returned' do
|
79
|
+
begin
|
80
|
+
Devise.default_url_options {{ :locale => I18n.locale }}
|
81
|
+
assert_equal '/account', Devise.mappings[:account].parsed_path
|
82
|
+
assert_equal '/en/organizers', Devise.mappings[:manager].parsed_path
|
83
|
+
ensure
|
84
|
+
Devise.default_url_options {{ }}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
58
88
|
test 'magic predicates' do
|
59
89
|
mapping = Devise.mappings[:user]
|
60
90
|
assert mapping.authenticatable?
|
@@ -4,7 +4,7 @@ ActionController::Routing::Routes.draw do |map|
|
|
4
4
|
map.devise_for :account, :path_names => {
|
5
5
|
:sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification'
|
6
6
|
}
|
7
|
-
map.devise_for :organizers, :singular => 'manager'
|
7
|
+
map.devise_for :organizers, :singular => 'manager', :path_prefix => '/:locale'
|
8
8
|
|
9
9
|
map.resources :users, :only => :index
|
10
10
|
map.resources :admins, :only => :index
|
data/test/routes_test.rb
CHANGED
@@ -69,7 +69,11 @@ class MapRoutingTest < ActionController::TestCase
|
|
69
69
|
end
|
70
70
|
|
71
71
|
test 'map organizer with custom singular name' do
|
72
|
-
assert_recognizes({:controller => 'passwords', :action => 'new'}, 'organizers/password/new')
|
72
|
+
assert_recognizes({:controller => 'passwords', :action => 'new', :locale => "en"}, '/en/organizers/password/new')
|
73
|
+
end
|
74
|
+
|
75
|
+
test 'map organizer with path prefix' do
|
76
|
+
assert_recognizes({:controller => 'sessions', :action => 'new', :locale => "en"}, '/en/organizers/sign_in')
|
73
77
|
end
|
74
78
|
|
75
79
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Jos\xC3\xA9 Valim"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-11-
|
13
|
+
date: 2009-11-06 00:00:00 -02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -112,43 +112,43 @@ signing_key:
|
|
112
112
|
specification_version: 3
|
113
113
|
summary: Flexible authentication solution for Rails with Warden
|
114
114
|
test_files:
|
115
|
-
- test/
|
116
|
-
- test/
|
115
|
+
- test/rails_app/config/boot.rb
|
116
|
+
- test/rails_app/config/routes.rb
|
117
|
+
- test/rails_app/config/environments/development.rb
|
118
|
+
- test/rails_app/config/environments/production.rb
|
119
|
+
- test/rails_app/config/environments/test.rb
|
120
|
+
- test/rails_app/config/environment.rb
|
121
|
+
- test/rails_app/config/initializers/session_store.rb
|
122
|
+
- test/rails_app/config/initializers/new_rails_defaults.rb
|
123
|
+
- test/rails_app/app/controllers/users_controller.rb
|
124
|
+
- test/rails_app/app/controllers/application_controller.rb
|
125
|
+
- test/rails_app/app/controllers/admins_controller.rb
|
126
|
+
- test/rails_app/app/controllers/home_controller.rb
|
127
|
+
- test/rails_app/app/helpers/application_helper.rb
|
128
|
+
- test/rails_app/app/models/admin.rb
|
129
|
+
- test/rails_app/app/models/organizer.rb
|
130
|
+
- test/rails_app/app/models/account.rb
|
131
|
+
- test/rails_app/app/models/user.rb
|
117
132
|
- test/controllers/url_helpers_test.rb
|
118
|
-
- test/
|
119
|
-
- test/
|
133
|
+
- test/controllers/helpers_test.rb
|
134
|
+
- test/controllers/filters_test.rb
|
135
|
+
- test/models_test.rb
|
120
136
|
- test/integration/authenticatable_test.rb
|
121
|
-
- test/integration/confirmable_test.rb
|
122
|
-
- test/integration/recoverable_test.rb
|
123
137
|
- test/integration/rememberable_test.rb
|
138
|
+
- test/integration/recoverable_test.rb
|
139
|
+
- test/integration/confirmable_test.rb
|
124
140
|
- test/mailers/confirmation_instructions_test.rb
|
125
141
|
- test/mailers/reset_password_instructions_test.rb
|
126
|
-
- test/mapping_test.rb
|
127
142
|
- test/models/authenticatable_test.rb
|
128
|
-
- test/models/confirmable_test.rb
|
129
|
-
- test/models/recoverable_test.rb
|
130
143
|
- test/models/rememberable_test.rb
|
144
|
+
- test/models/recoverable_test.rb
|
131
145
|
- test/models/validatable_test.rb
|
132
|
-
- test/
|
133
|
-
- test/
|
134
|
-
- test/
|
135
|
-
- test/rails_app/app/controllers/home_controller.rb
|
136
|
-
- test/rails_app/app/controllers/users_controller.rb
|
137
|
-
- test/rails_app/app/helpers/application_helper.rb
|
138
|
-
- test/rails_app/app/models/account.rb
|
139
|
-
- test/rails_app/app/models/admin.rb
|
140
|
-
- test/rails_app/app/models/organizer.rb
|
141
|
-
- test/rails_app/app/models/user.rb
|
142
|
-
- test/rails_app/config/boot.rb
|
143
|
-
- test/rails_app/config/environment.rb
|
144
|
-
- test/rails_app/config/environments/development.rb
|
145
|
-
- test/rails_app/config/environments/production.rb
|
146
|
-
- test/rails_app/config/environments/test.rb
|
147
|
-
- test/rails_app/config/initializers/new_rails_defaults.rb
|
148
|
-
- test/rails_app/config/initializers/session_store.rb
|
149
|
-
- test/rails_app/config/routes.rb
|
150
|
-
- test/routes_test.rb
|
146
|
+
- test/models/confirmable_test.rb
|
147
|
+
- test/failure_test.rb
|
148
|
+
- test/support/model_tests_helper.rb
|
151
149
|
- test/support/assertions_helper.rb
|
152
150
|
- test/support/integration_tests_helper.rb
|
153
|
-
- test/
|
151
|
+
- test/devise_test.rb
|
152
|
+
- test/routes_test.rb
|
154
153
|
- test/test_helper.rb
|
154
|
+
- test/mapping_test.rb
|