devise 2.1.0 → 2.1.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 +34 -17
- data/Gemfile +1 -1
- data/Gemfile.lock +45 -45
- data/README.md +23 -18
- data/Rakefile +1 -1
- data/app/controllers/devise/omniauth_callbacks_controller.rb +6 -0
- data/app/controllers/devise/passwords_controller.rb +9 -0
- data/app/controllers/devise/sessions_controller.rb +1 -0
- data/app/controllers/devise_controller.rb +16 -5
- data/app/views/devise/confirmations/new.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +1 -1
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/registrations/edit.html.erb +1 -1
- data/app/views/devise/registrations/new.html.erb +1 -1
- data/app/views/devise/sessions/new.html.erb +1 -1
- data/app/views/devise/unlocks/new.html.erb +1 -1
- data/config/locales/en.yml +1 -0
- data/devise.gemspec +2 -2
- data/lib/devise.rb +5 -1
- data/lib/devise/controllers/helpers.rb +11 -8
- data/lib/devise/hooks/timeoutable.rb +6 -3
- data/lib/devise/models.rb +5 -4
- data/lib/devise/models/authenticatable.rb +49 -12
- data/lib/devise/models/confirmable.rb +2 -2
- data/lib/devise/models/database_authenticatable.rb +1 -1
- data/lib/devise/models/lockable.rb +8 -4
- data/lib/devise/models/recoverable.rb +1 -1
- data/lib/devise/omniauth.rb +1 -1
- data/lib/devise/omniauth/url_helpers.rb +0 -15
- data/lib/devise/rails/routes.rb +59 -25
- data/lib/devise/strategies/authenticatable.rb +16 -5
- data/lib/devise/strategies/base.rb +5 -0
- data/lib/devise/strategies/database_authenticatable.rb +1 -2
- data/lib/devise/strategies/rememberable.rb +5 -3
- data/lib/devise/strategies/token_authenticatable.rb +1 -2
- data/lib/devise/version.rb +1 -1
- data/lib/generators/devise/views_generator.rb +6 -0
- data/lib/generators/mongoid/devise_generator.rb +5 -2
- data/lib/generators/templates/devise.rb +20 -4
- data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +3 -3
- data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +3 -3
- data/lib/generators/templates/simple_form_for/passwords/new.html.erb +3 -3
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +3 -3
- data/lib/generators/templates/simple_form_for/registrations/new.html.erb +3 -3
- data/lib/generators/templates/simple_form_for/sessions/new.html.erb +3 -3
- data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +3 -3
- data/test/controllers/helpers_test.rb +6 -7
- data/test/controllers/sessions_controller_test.rb +22 -15
- data/test/integration/authenticatable_test.rb +109 -63
- data/test/integration/recoverable_test.rb +6 -0
- data/test/integration/timeoutable_test.rb +28 -2
- data/test/models/recoverable_test.rb +3 -3
- data/test/models_test.rb +3 -3
- data/test/omniauth/url_helpers_test.rb +1 -8
- data/test/rails_app/app/controllers/admins_controller.rb +5 -0
- data/test/rails_app/config/routes.rb +11 -1
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +3 -0
- data/test/support/assertions.rb +6 -8
- data/test/support/integration.rb +2 -1
- metadata +14 -19
data/CHANGELOG.rdoc
CHANGED
@@ -1,15 +1,46 @@
|
|
1
|
-
==
|
1
|
+
== 2.1.2
|
2
|
+
|
3
|
+
* Enhancements
|
4
|
+
* Handle backwards incompatibility between Rails 3.2.6 and Thor 0.15.x
|
5
|
+
|
6
|
+
* bug fix
|
7
|
+
* Fix regression on strategy validation on previous release
|
8
|
+
|
9
|
+
== 2.1.1 (yanked)
|
2
10
|
|
3
11
|
* enhancements
|
12
|
+
* `sign_out_all_scopes` now locks warden and does not allow new logins in the same action
|
13
|
+
* `Devise.omniauth_path_prefix` is available to configure omniauth path prefix
|
14
|
+
* Redirect to sign in page when trying to access password#edit without a token (by @gbataille)
|
15
|
+
* Allow a lambda in authenticate(d) routes helpers to further select the scope
|
16
|
+
* Removed warnings on Rails 3.2.6 (by @nashby)
|
17
|
+
|
18
|
+
* bug fix
|
19
|
+
* `update_with_password` now relies on assign_attributes and forwards the :as option (by @wtn)
|
20
|
+
* Do not trigger timeout on sign in related actions
|
21
|
+
* Timeout does not explode when reset_authentication_token! is accidentally defined by Active Model (by @remomueller)
|
22
|
+
|
23
|
+
* deprecations
|
24
|
+
* Strategy#validate() no longer validates nil resources
|
25
|
+
|
26
|
+
== 2.1.0
|
27
|
+
|
28
|
+
* enhancements
|
29
|
+
* Add `check_fields!(model_class)` method on Devise::Models to check if the model includes the fields that Devise uses
|
30
|
+
* Add `skip_reconfirmation!` to skip reconfirmation
|
4
31
|
* Devise model generator now works with engines
|
5
32
|
* Devise encryptable was moved to its new gem (http://github.com/plataformatec/devise-encryptable)
|
6
33
|
|
7
34
|
* deprecations
|
8
35
|
* Deprecations warnings added on Devise 2.0 are now removed with their features
|
9
|
-
*
|
10
|
-
*
|
36
|
+
* All devise modules should now have a `required_fields(klass)` module method to help gathering missing attributes
|
37
|
+
* `use_salt_as_remember_token` and `apply_schema` does not have any effect since 2.0 and are now deprecated
|
38
|
+
* `valid_for_authentication?` must now return a boolean
|
11
39
|
|
12
40
|
* bug fix
|
41
|
+
* Ensure after sign in hook is not called without a resource
|
42
|
+
* Fix a term: now on Omniauth related flash messages, we say that we're authenticating from an omniauth provider instead of authorizing
|
43
|
+
* Fixed redirect when authenticated mounted apps (by @hakanensari)
|
13
44
|
* Ensure the failure app still respects config.relative_url_root
|
14
45
|
* `/users/sign_in` doesn't choke on protected attributes used to select sign in scope (by @Paymium)
|
15
46
|
* `failed_attempts` is set to zero after any sign in (including via reset password) (by @rodrigoflores)
|
@@ -18,20 +49,6 @@
|
|
18
49
|
* Better support for custom strategies on test helpers (by @mattconnolly)
|
19
50
|
* Return `head :no_content` in SessionsController now that most JS libraries handle it (by @julianvargasalvarez)
|
20
51
|
|
21
|
-
== 2.1.0.rc
|
22
|
-
|
23
|
-
* enhancements
|
24
|
-
* Add check_fields! method on Devise::Models to check if the model includes the fields that Devise uses
|
25
|
-
* Add `skip_reconfirmation!` to skip reconfirmation
|
26
|
-
|
27
|
-
* bug fix
|
28
|
-
* Ensure after sign in hook is not called without a resource
|
29
|
-
* Fix a term: now on Omniauth related flash messages, we say that we're authenticating from an omniauth provider instead of authorizing
|
30
|
-
* Fixed redirect when authenticated mounted apps (by @hakanensari)
|
31
|
-
|
32
|
-
* deprecation
|
33
|
-
* All devise modules should have a required_fields(klass) module method to help gathering missing attributes
|
34
|
-
|
35
52
|
== 2.0.4
|
36
53
|
|
37
54
|
Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,44 +1,44 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
devise (2.1.
|
4
|
+
devise (2.1.2)
|
5
5
|
bcrypt-ruby (~> 3.0)
|
6
|
-
orm_adapter (~> 0.
|
6
|
+
orm_adapter (~> 0.1)
|
7
7
|
railties (~> 3.1)
|
8
|
-
warden (~> 1.
|
8
|
+
warden (~> 1.2.1)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: http://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actionmailer (3.2.
|
14
|
-
actionpack (= 3.2.
|
15
|
-
mail (~> 2.4.
|
16
|
-
actionpack (3.2.
|
17
|
-
activemodel (= 3.2.
|
18
|
-
activesupport (= 3.2.
|
13
|
+
actionmailer (3.2.6)
|
14
|
+
actionpack (= 3.2.6)
|
15
|
+
mail (~> 2.4.4)
|
16
|
+
actionpack (3.2.6)
|
17
|
+
activemodel (= 3.2.6)
|
18
|
+
activesupport (= 3.2.6)
|
19
19
|
builder (~> 3.0.0)
|
20
20
|
erubis (~> 2.7.0)
|
21
|
-
journey (~> 1.0.
|
21
|
+
journey (~> 1.0.1)
|
22
22
|
rack (~> 1.4.0)
|
23
|
-
rack-cache (~> 1.
|
23
|
+
rack-cache (~> 1.2)
|
24
24
|
rack-test (~> 0.6.1)
|
25
|
-
sprockets (~> 2.1.
|
26
|
-
activemodel (3.2.
|
27
|
-
activesupport (= 3.2.
|
25
|
+
sprockets (~> 2.1.3)
|
26
|
+
activemodel (3.2.6)
|
27
|
+
activesupport (= 3.2.6)
|
28
28
|
builder (~> 3.0.0)
|
29
|
-
activerecord (3.2.
|
30
|
-
activemodel (= 3.2.
|
31
|
-
activesupport (= 3.2.
|
32
|
-
arel (~> 3.0.
|
29
|
+
activerecord (3.2.6)
|
30
|
+
activemodel (= 3.2.6)
|
31
|
+
activesupport (= 3.2.6)
|
32
|
+
arel (~> 3.0.2)
|
33
33
|
tzinfo (~> 0.3.29)
|
34
|
-
activeresource (3.2.
|
35
|
-
activemodel (= 3.2.
|
36
|
-
activesupport (= 3.2.
|
37
|
-
activesupport (3.2.
|
34
|
+
activeresource (3.2.6)
|
35
|
+
activemodel (= 3.2.6)
|
36
|
+
activesupport (= 3.2.6)
|
37
|
+
activesupport (3.2.6)
|
38
38
|
i18n (~> 0.6)
|
39
39
|
multi_json (~> 1.0)
|
40
40
|
addressable (2.2.6)
|
41
|
-
arel (3.0.
|
41
|
+
arel (3.0.2)
|
42
42
|
bcrypt-ruby (3.0.1)
|
43
43
|
bson (1.5.1)
|
44
44
|
bson_ext (1.3.1)
|
@@ -52,16 +52,16 @@ GEM
|
|
52
52
|
hashie (1.2.0)
|
53
53
|
hike (1.2.1)
|
54
54
|
i18n (0.6.0)
|
55
|
-
journey (1.0.
|
56
|
-
json (1.
|
55
|
+
journey (1.0.4)
|
56
|
+
json (1.7.3)
|
57
57
|
linecache (0.46)
|
58
58
|
rbx-require-relative (> 0.0.4)
|
59
|
-
mail (2.4.
|
59
|
+
mail (2.4.4)
|
60
60
|
i18n (>= 0.4.0)
|
61
61
|
mime-types (~> 1.16)
|
62
62
|
treetop (~> 1.4.8)
|
63
63
|
metaclass (0.0.1)
|
64
|
-
mime-types (1.
|
64
|
+
mime-types (1.18)
|
65
65
|
mocha (0.10.0)
|
66
66
|
metaclass (~> 0.0.1)
|
67
67
|
mongo (1.3.1)
|
@@ -87,10 +87,10 @@ GEM
|
|
87
87
|
omniauth-openid (1.0.1)
|
88
88
|
omniauth (~> 1.0)
|
89
89
|
rack-openid (~> 1.3.1)
|
90
|
-
orm_adapter (0.0
|
90
|
+
orm_adapter (0.1.0)
|
91
91
|
polyglot (0.3.3)
|
92
92
|
rack (1.4.1)
|
93
|
-
rack-cache (1.
|
93
|
+
rack-cache (1.2)
|
94
94
|
rack (>= 0.4)
|
95
95
|
rack-openid (1.3.1)
|
96
96
|
rack (>= 1.1.0)
|
@@ -99,21 +99,21 @@ GEM
|
|
99
99
|
rack
|
100
100
|
rack-test (0.6.1)
|
101
101
|
rack (>= 1.0)
|
102
|
-
rails (3.2.
|
103
|
-
actionmailer (= 3.2.
|
104
|
-
actionpack (= 3.2.
|
105
|
-
activerecord (= 3.2.
|
106
|
-
activeresource (= 3.2.
|
107
|
-
activesupport (= 3.2.
|
102
|
+
rails (3.2.6)
|
103
|
+
actionmailer (= 3.2.6)
|
104
|
+
actionpack (= 3.2.6)
|
105
|
+
activerecord (= 3.2.6)
|
106
|
+
activeresource (= 3.2.6)
|
107
|
+
activesupport (= 3.2.6)
|
108
108
|
bundler (~> 1.0)
|
109
|
-
railties (= 3.2.
|
110
|
-
railties (3.2.
|
111
|
-
actionpack (= 3.2.
|
112
|
-
activesupport (= 3.2.
|
109
|
+
railties (= 3.2.6)
|
110
|
+
railties (3.2.6)
|
111
|
+
actionpack (= 3.2.6)
|
112
|
+
activesupport (= 3.2.6)
|
113
113
|
rack-ssl (~> 1.3.2)
|
114
114
|
rake (>= 0.8.7)
|
115
115
|
rdoc (~> 3.4)
|
116
|
-
thor (
|
116
|
+
thor (>= 0.14.6, < 2.0)
|
117
117
|
rake (0.9.2.2)
|
118
118
|
rbx-require-relative (0.0.5)
|
119
119
|
rdoc (3.12)
|
@@ -124,18 +124,18 @@ GEM
|
|
124
124
|
ruby-debug-base (0.10.4)
|
125
125
|
linecache (>= 0.3)
|
126
126
|
ruby-openid (2.1.8)
|
127
|
-
sprockets (2.1.
|
127
|
+
sprockets (2.1.3)
|
128
128
|
hike (~> 1.2)
|
129
129
|
rack (~> 1.0)
|
130
130
|
tilt (~> 1.1, != 1.3.0)
|
131
131
|
sqlite3 (1.3.5)
|
132
|
-
thor (0.
|
132
|
+
thor (0.15.2)
|
133
133
|
tilt (1.3.3)
|
134
134
|
treetop (1.4.10)
|
135
135
|
polyglot
|
136
136
|
polyglot (>= 0.3.1)
|
137
|
-
tzinfo (0.3.
|
138
|
-
warden (1.
|
137
|
+
tzinfo (0.3.33)
|
138
|
+
warden (1.2.1)
|
139
139
|
rack (>= 1.0)
|
140
140
|
webrat (0.7.2)
|
141
141
|
nokogiri (>= 1.2.0)
|
@@ -158,7 +158,7 @@ DEPENDENCIES
|
|
158
158
|
omniauth-facebook
|
159
159
|
omniauth-oauth2 (~> 1.0.0)
|
160
160
|
omniauth-openid (~> 1.0.1)
|
161
|
-
rails (~> 3.2.
|
161
|
+
rails (~> 3.2.6)
|
162
162
|
rdoc
|
163
163
|
ruby-debug (>= 0.10.3)
|
164
164
|
sqlite3
|
data/README.md
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
*IMPORTANT:* Devise 2.1 is out. If you are upgrading, please read: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.1
|
2
2
|
|
3
|
-
*IMPORTANT:* Devise 2.0 is out. If you are upgrading, please read: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0
|
4
|
-
|
5
3
|
## Devise
|
6
4
|
|
7
5
|
INFO: This README is [also available in a friendly navigable format](http://devise.plataformatec.com.br/).
|
8
6
|
|
9
|
-
[![Build Status](https://secure.travis-ci.org/plataformatec/devise.png)](http://travis-ci.org/plataformatec/devise)
|
7
|
+
[![Build Status](https://secure.travis-ci.org/plataformatec/devise.png)](http://travis-ci.org/plataformatec/devise) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/plataformatec/devise)
|
10
8
|
|
11
9
|
Devise is a flexible authentication solution for Rails based on Warden. It:
|
12
10
|
|
@@ -15,11 +13,11 @@ Devise is a flexible authentication solution for Rails based on Warden. It:
|
|
15
13
|
* Allows you to have multiple roles (or models/scopes) signed in at the same time;
|
16
14
|
* Is based on a modularity concept: use just what you really need.
|
17
15
|
|
18
|
-
It's
|
16
|
+
It's composed of 12 modules:
|
19
17
|
|
20
18
|
* [Database Authenticatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/DatabaseAuthenticatable): encrypts and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
|
21
19
|
* [Token Authenticatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/TokenAuthenticatable): signs in a user based on an authentication token (also known as "single access token"). The token can be given both through query string or HTTP Basic Authentication.
|
22
|
-
* [Omniauthable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Omniauthable): adds Omniauth (github.com/intridea/omniauth) support;
|
20
|
+
* [Omniauthable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Omniauthable): adds Omniauth (https://github.com/intridea/omniauth) support;
|
23
21
|
* [Confirmable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable): sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
|
24
22
|
* [Recoverable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Recoverable): resets the user password and sends reset instructions.
|
25
23
|
* [Registerable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Registerable): handles signing up users through a registration process, also allowing them to edit and destroy their account.
|
@@ -306,17 +304,7 @@ https://github.com/plataformatec/devise/wiki/I18n
|
|
306
304
|
|
307
305
|
### Test helpers
|
308
306
|
|
309
|
-
Devise includes some tests helpers for functional specs.
|
310
|
-
|
311
|
-
```ruby
|
312
|
-
sign_in :user, @user # sign_in(scope, resource)
|
313
|
-
sign_in @user # sign_in(resource)
|
314
|
-
|
315
|
-
sign_out :user # sign_out(scope)
|
316
|
-
sign_out @user # sign_out(resource)
|
317
|
-
```
|
318
|
-
|
319
|
-
You can include the Devise Test Helpers in all of your tests by adding the following to the bottom of your test/test_helper.rb file:
|
307
|
+
Devise includes some tests helpers for functional specs. In other to use them, you need to include Devise in your functional tests by adding the following to the bottom of your `test/test_helper.rb` file:
|
320
308
|
|
321
309
|
```ruby
|
322
310
|
class ActionController::TestCase
|
@@ -324,7 +312,7 @@ class ActionController::TestCase
|
|
324
312
|
end
|
325
313
|
```
|
326
314
|
|
327
|
-
If you're using RSpec
|
315
|
+
If you're using RSpec, you can put the following inside a file named `spec/support/devise.rb`:
|
328
316
|
|
329
317
|
```ruby
|
330
318
|
RSpec.configure do |config|
|
@@ -332,7 +320,24 @@ RSpec.configure do |config|
|
|
332
320
|
end
|
333
321
|
```
|
334
322
|
|
335
|
-
|
323
|
+
Now you are ready to use the `sign_in` and `sign_out` methods. Such methods have the same signature as in controllers:
|
324
|
+
|
325
|
+
```ruby
|
326
|
+
sign_in :user, @user # sign_in(scope, resource)
|
327
|
+
sign_in @user # sign_in(resource)
|
328
|
+
|
329
|
+
sign_out :user # sign_out(scope)
|
330
|
+
sign_out @user # sign_out(resource)
|
331
|
+
```
|
332
|
+
|
333
|
+
There are two things that is important to keep in mind:
|
334
|
+
|
335
|
+
1) These helpers are not going to work for integration tests driven by Capybara or Webrat. They are meant to be used with functional tests only. Instead, fill in the form or explicitly set the user in session;
|
336
|
+
|
337
|
+
2) If you are testing Devise internal controllers or a controller that inherits from Devise's, you need to tell Devise which mapping should be used before a request. This is necessary because Devise gets this information from router, but since functional tests do not pass through the router, it needs to be told explicitly. For example, if you are testing the user scope, simply do:
|
338
|
+
|
339
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
340
|
+
get :new
|
336
341
|
|
337
342
|
### Omniauth
|
338
343
|
|
data/Rakefile
CHANGED
@@ -29,6 +29,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
29
29
|
rdoc.rdoc_dir = 'rdoc'
|
30
30
|
rdoc.title = 'Devise'
|
31
31
|
rdoc.options << '--line-numbers' << '--inline-source'
|
32
|
-
rdoc.rdoc_files.include('README.
|
32
|
+
rdoc.rdoc_files.include('README.md')
|
33
33
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
34
34
|
end
|
@@ -1,4 +1,10 @@
|
|
1
1
|
class Devise::OmniauthCallbacksController < DeviseController
|
2
|
+
prepend_before_filter { request.env["devise.skip_timeout"] = true }
|
3
|
+
|
4
|
+
def passthru
|
5
|
+
render :status => 404, :text => "Not found. Authentication passthru."
|
6
|
+
end
|
7
|
+
|
2
8
|
def failure
|
3
9
|
set_flash_message :alert, :failure, :kind => failed_strategy.name.to_s.humanize, :reason => failure_message
|
4
10
|
redirect_to after_omniauth_failure_path_for(resource_name)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class Devise::PasswordsController < DeviseController
|
2
2
|
prepend_before_filter :require_no_authentication
|
3
|
+
# Render the #edit only if coming from a reset password email link
|
4
|
+
append_before_filter :assert_reset_token_passed, :only => :edit
|
3
5
|
|
4
6
|
# GET /resource/password/new
|
5
7
|
def new
|
@@ -44,4 +46,11 @@ class Devise::PasswordsController < DeviseController
|
|
44
46
|
new_session_path(resource_name)
|
45
47
|
end
|
46
48
|
|
49
|
+
# Check if a reset_password_token is provided in the request
|
50
|
+
def assert_reset_token_passed
|
51
|
+
if params[:reset_password_token].blank?
|
52
|
+
set_flash_message(:error, :no_token)
|
53
|
+
redirect_to new_session_path(resource_name)
|
54
|
+
end
|
55
|
+
end
|
47
56
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Devise::SessionsController < DeviseController
|
2
2
|
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
3
3
|
prepend_before_filter :allow_params_authentication!, :only => :create
|
4
|
+
prepend_before_filter { request.env["devise.skip_timeout"] = true }
|
4
5
|
|
5
6
|
# GET /resource/sign_in
|
6
7
|
def new
|
@@ -43,8 +43,11 @@ class DeviseController < Devise.parent_controller.constantize
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# Override prefixes to consider the scoped view.
|
46
|
+
# Notice we need to check for the request due to a bug in
|
47
|
+
# Action Controller tests that forces _prefixes to be
|
48
|
+
# loaded before even having a request object.
|
46
49
|
def _prefixes #:nodoc:
|
47
|
-
@_prefixes ||= if self.class.scoped_views? && devise_mapping
|
50
|
+
@_prefixes ||= if self.class.scoped_views? && request && devise_mapping
|
48
51
|
super.unshift("#{devise_mapping.scoped_path}/#{controller_name}")
|
49
52
|
else
|
50
53
|
super
|
@@ -59,11 +62,19 @@ class DeviseController < Devise.parent_controller.constantize
|
|
59
62
|
def assert_is_devise_resource! #:nodoc:
|
60
63
|
unknown_action! <<-MESSAGE unless devise_mapping
|
61
64
|
Could not find devise mapping for path #{request.fullpath.inspect}.
|
62
|
-
|
65
|
+
This may happen for two reasons:
|
66
|
+
|
67
|
+
1) You forgot to wrap your route inside the scope block. For example:
|
68
|
+
|
69
|
+
devise_scope :user do
|
70
|
+
match "/some/route" => "some_devise_controller"
|
71
|
+
end
|
72
|
+
|
73
|
+
2) You are testing a Devise controller bypassing the router.
|
74
|
+
If so, you can explicitly tell Devise which mapping to use:
|
75
|
+
|
76
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
63
77
|
|
64
|
-
devise_scope :user do
|
65
|
-
match "/some/route" => "some_devise_controller"
|
66
|
-
end
|
67
78
|
MESSAGE
|
68
79
|
end
|
69
80
|
|
@@ -20,6 +20,6 @@
|
|
20
20
|
|
21
21
|
<h3>Cancel my account</h3>
|
22
22
|
|
23
|
-
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
|
23
|
+
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.</p>
|
24
24
|
|
25
25
|
<%= link_to "Back", :back %>
|