devise 2.2.3 → 2.2.4
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.
- checksums.yaml +15 -0
- data/.travis.yml +0 -7
- data/.yardopts +9 -0
- data/CHANGELOG.rdoc +18 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +57 -57
- data/README.md +8 -4
- data/Rakefile +1 -0
- data/app/controllers/devise/confirmations_controller.rb +1 -1
- data/app/controllers/devise/passwords_controller.rb +5 -2
- data/app/controllers/devise/sessions_controller.rb +0 -1
- data/app/controllers/devise/unlocks_controller.rb +2 -2
- data/app/controllers/devise_controller.rb +9 -4
- data/app/views/devise/registrations/edit.html.erb +1 -1
- data/devise.gemspec +1 -0
- data/devise.png +0 -0
- data/gemfiles/Gemfile.rails-3.1.x +4 -4
- data/gemfiles/Gemfile.rails-3.1.x.lock +56 -56
- data/lib/devise.rb +18 -2
- data/lib/devise/mailers/helpers.rb +5 -4
- data/lib/devise/models/authenticatable.rb +24 -8
- data/lib/devise/models/confirmable.rb +23 -3
- data/lib/devise/models/database_authenticatable.rb +15 -0
- data/lib/devise/models/omniauthable.rb +2 -2
- data/lib/devise/models/recoverable.rb +1 -1
- data/lib/devise/models/timeoutable.rb +1 -1
- data/lib/devise/param_filter.rb +8 -8
- data/lib/devise/rails/routes.rb +22 -17
- data/lib/devise/rails/warden_compat.rb +0 -29
- data/lib/devise/strategies/authenticatable.rb +8 -5
- data/lib/devise/strategies/token_authenticatable.rb +38 -3
- data/lib/devise/version.rb +1 -1
- data/lib/generators/devise/views_generator.rb +8 -2
- data/lib/generators/templates/devise.rb +10 -4
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +1 -1
- data/test/controllers/passwords_controller_test.rb +32 -0
- data/test/failure_app_test.rb +3 -3
- data/test/generators/views_generator_test.rb +16 -1
- data/test/helpers/devise_helper_test.rb +1 -1
- data/test/integration/authenticatable_test.rb +72 -25
- data/test/integration/confirmable_test.rb +6 -6
- data/test/integration/database_authenticatable_test.rb +1 -1
- data/test/integration/http_authenticatable_test.rb +19 -1
- data/test/integration/lockable_test.rb +1 -1
- data/test/integration/omniauthable_test.rb +2 -2
- data/test/integration/recoverable_test.rb +2 -2
- data/test/integration/registerable_test.rb +4 -4
- data/test/integration/rememberable_test.rb +9 -9
- data/test/integration/timeoutable_test.rb +1 -1
- data/test/integration/token_authenticatable_test.rb +45 -1
- data/test/integration/trackable_test.rb +1 -1
- data/test/mailers/confirmation_instructions_test.rb +11 -2
- data/test/mailers/reset_password_instructions_test.rb +11 -2
- data/test/mailers/unlock_instructions_test.rb +11 -1
- data/test/models/authenticatable_test.rb +3 -3
- data/test/models/confirmable_test.rb +17 -0
- data/test/models/database_authenticatable_test.rb +32 -0
- data/test/models/lockable_test.rb +1 -1
- data/test/models/rememberable_test.rb +4 -3
- data/test/models/serializable_test.rb +6 -6
- data/test/models/validatable_test.rb +3 -3
- data/test/models_test.rb +6 -1
- data/test/rails_app/app/mailers/users/mailer.rb +5 -1
- data/test/rails_app/config/routes.rb +13 -13
- data/test/test_helper.rb +1 -1
- metadata +23 -28
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
devise (2.2.
|
4
|
+
devise (2.2.4)
|
5
5
|
bcrypt-ruby (~> 3.0)
|
6
6
|
orm_adapter (~> 0.1)
|
7
7
|
railties (~> 3.1)
|
8
8
|
warden (~> 1.2.1)
|
9
9
|
|
10
10
|
GEM
|
11
|
-
remote:
|
11
|
+
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actionmailer (3.1.
|
14
|
-
actionpack (= 3.1.
|
15
|
-
mail (~> 2.
|
16
|
-
actionpack (3.1.
|
17
|
-
activemodel (= 3.1.
|
18
|
-
activesupport (= 3.1.
|
13
|
+
actionmailer (3.1.12)
|
14
|
+
actionpack (= 3.1.12)
|
15
|
+
mail (~> 2.4.4)
|
16
|
+
actionpack (3.1.12)
|
17
|
+
activemodel (= 3.1.12)
|
18
|
+
activesupport (= 3.1.12)
|
19
19
|
builder (~> 3.0.0)
|
20
20
|
erubis (~> 2.7.0)
|
21
21
|
i18n (~> 0.6)
|
@@ -24,54 +24,54 @@ GEM
|
|
24
24
|
rack-mount (~> 0.8.2)
|
25
25
|
rack-test (~> 0.6.1)
|
26
26
|
sprockets (~> 2.0.4)
|
27
|
-
activemodel (3.1.
|
28
|
-
activesupport (= 3.1.
|
27
|
+
activemodel (3.1.12)
|
28
|
+
activesupport (= 3.1.12)
|
29
29
|
builder (~> 3.0.0)
|
30
30
|
i18n (~> 0.6)
|
31
|
-
activerecord (3.1.
|
32
|
-
activemodel (= 3.1.
|
33
|
-
activesupport (= 3.1.
|
31
|
+
activerecord (3.1.12)
|
32
|
+
activemodel (= 3.1.12)
|
33
|
+
activesupport (= 3.1.12)
|
34
34
|
arel (~> 2.2.3)
|
35
35
|
tzinfo (~> 0.3.29)
|
36
|
-
activeresource (3.1.
|
37
|
-
activemodel (= 3.1.
|
38
|
-
activesupport (= 3.1.
|
39
|
-
activesupport (3.1.
|
40
|
-
multi_json (
|
36
|
+
activeresource (3.1.12)
|
37
|
+
activemodel (= 3.1.12)
|
38
|
+
activesupport (= 3.1.12)
|
39
|
+
activesupport (3.1.12)
|
40
|
+
multi_json (~> 1.0)
|
41
41
|
arel (2.2.3)
|
42
42
|
bcrypt-ruby (3.0.1)
|
43
43
|
builder (3.0.4)
|
44
44
|
columnize (0.3.6)
|
45
45
|
erubis (2.7.0)
|
46
|
-
faraday (0.8.
|
46
|
+
faraday (0.8.7)
|
47
47
|
multipart-post (~> 1.1)
|
48
48
|
hashie (1.2.0)
|
49
|
-
hike (1.2.
|
49
|
+
hike (1.2.2)
|
50
50
|
httpauth (0.2.0)
|
51
|
-
i18n (0.6.
|
52
|
-
json (1.7.
|
53
|
-
jwt (0.1.
|
54
|
-
multi_json (>= 1.
|
51
|
+
i18n (0.6.4)
|
52
|
+
json (1.7.7)
|
53
|
+
jwt (0.1.8)
|
54
|
+
multi_json (>= 1.5)
|
55
55
|
linecache (0.46)
|
56
56
|
rbx-require-relative (> 0.0.4)
|
57
|
-
mail (2.
|
57
|
+
mail (2.4.4)
|
58
58
|
i18n (>= 0.4.0)
|
59
59
|
mime-types (~> 1.16)
|
60
60
|
treetop (~> 1.4.8)
|
61
61
|
metaclass (0.0.1)
|
62
|
-
mime-types (1.
|
63
|
-
mocha (0.
|
62
|
+
mime-types (1.23)
|
63
|
+
mocha (0.13.3)
|
64
64
|
metaclass (~> 0.0.1)
|
65
|
-
mongoid (3.0.
|
65
|
+
mongoid (3.0.23)
|
66
66
|
activemodel (~> 3.1)
|
67
|
-
moped (~> 1.
|
67
|
+
moped (~> 1.2)
|
68
68
|
origin (~> 1.0)
|
69
69
|
tzinfo (~> 0.3.22)
|
70
|
-
moped (1.
|
71
|
-
multi_json (1.
|
72
|
-
multipart-post (1.
|
73
|
-
nokogiri (1.5.
|
74
|
-
oauth2 (0.8.
|
70
|
+
moped (1.4.5)
|
71
|
+
multi_json (1.7.3)
|
72
|
+
multipart-post (1.2.0)
|
73
|
+
nokogiri (1.5.9)
|
74
|
+
oauth2 (0.8.1)
|
75
75
|
faraday (~> 0.8)
|
76
76
|
httpauth (~> 0.1)
|
77
77
|
jwt (~> 0.1.4)
|
@@ -88,10 +88,10 @@ GEM
|
|
88
88
|
omniauth-openid (1.0.1)
|
89
89
|
omniauth (~> 1.0)
|
90
90
|
rack-openid (~> 1.3.1)
|
91
|
-
origin (1.0
|
91
|
+
origin (1.1.0)
|
92
92
|
orm_adapter (0.4.0)
|
93
93
|
polyglot (0.3.3)
|
94
|
-
rack (1.3.
|
94
|
+
rack (1.3.10)
|
95
95
|
rack-cache (1.2)
|
96
96
|
rack (>= 0.4)
|
97
97
|
rack-mount (0.8.3)
|
@@ -99,49 +99,49 @@ GEM
|
|
99
99
|
rack-openid (1.3.1)
|
100
100
|
rack (>= 1.1.0)
|
101
101
|
ruby-openid (>= 2.1.8)
|
102
|
-
rack-ssl (1.3.
|
102
|
+
rack-ssl (1.3.3)
|
103
103
|
rack
|
104
104
|
rack-test (0.6.2)
|
105
105
|
rack (>= 1.0)
|
106
|
-
rails (3.1.
|
107
|
-
actionmailer (= 3.1.
|
108
|
-
actionpack (= 3.1.
|
109
|
-
activerecord (= 3.1.
|
110
|
-
activeresource (= 3.1.
|
111
|
-
activesupport (= 3.1.
|
106
|
+
rails (3.1.12)
|
107
|
+
actionmailer (= 3.1.12)
|
108
|
+
actionpack (= 3.1.12)
|
109
|
+
activerecord (= 3.1.12)
|
110
|
+
activeresource (= 3.1.12)
|
111
|
+
activesupport (= 3.1.12)
|
112
112
|
bundler (~> 1.0)
|
113
|
-
railties (= 3.1.
|
114
|
-
railties (3.1.
|
115
|
-
actionpack (= 3.1.
|
116
|
-
activesupport (= 3.1.
|
113
|
+
railties (= 3.1.12)
|
114
|
+
railties (3.1.12)
|
115
|
+
actionpack (= 3.1.12)
|
116
|
+
activesupport (= 3.1.12)
|
117
117
|
rack-ssl (~> 1.3.2)
|
118
118
|
rake (>= 0.8.7)
|
119
119
|
rdoc (~> 3.4)
|
120
120
|
thor (~> 0.14.6)
|
121
|
-
rake (10.0.
|
121
|
+
rake (10.0.4)
|
122
122
|
rbx-require-relative (0.0.9)
|
123
|
-
rdoc (3.12)
|
123
|
+
rdoc (3.12.2)
|
124
124
|
json (~> 1.4)
|
125
125
|
ruby-debug (0.10.4)
|
126
126
|
columnize (>= 0.1)
|
127
127
|
ruby-debug-base (~> 0.10.4.0)
|
128
128
|
ruby-debug-base (0.10.4)
|
129
129
|
linecache (>= 0.3)
|
130
|
-
ruby-openid (2.2.
|
130
|
+
ruby-openid (2.2.3)
|
131
131
|
sprockets (2.0.4)
|
132
132
|
hike (~> 1.2)
|
133
133
|
rack (~> 1.0)
|
134
134
|
tilt (~> 1.1, != 1.3.0)
|
135
|
-
sqlite3 (1.3.
|
135
|
+
sqlite3 (1.3.7)
|
136
136
|
thor (0.14.6)
|
137
|
-
tilt (1.
|
137
|
+
tilt (1.4.0)
|
138
138
|
treetop (1.4.12)
|
139
139
|
polyglot
|
140
140
|
polyglot (>= 0.3.1)
|
141
|
-
tzinfo (0.3.
|
141
|
+
tzinfo (0.3.37)
|
142
142
|
warden (1.2.1)
|
143
143
|
rack (>= 1.0)
|
144
|
-
webrat (0.7.
|
144
|
+
webrat (0.7.3)
|
145
145
|
nokogiri (>= 1.2.0)
|
146
146
|
rack (>= 1.0)
|
147
147
|
rack-test (>= 0.5.3)
|
@@ -154,7 +154,7 @@ DEPENDENCIES
|
|
154
154
|
activerecord-jdbcsqlite3-adapter
|
155
155
|
devise!
|
156
156
|
jruby-openssl
|
157
|
-
mocha (
|
157
|
+
mocha (~> 0.13.1)
|
158
158
|
mongoid (~> 3.0)
|
159
159
|
omniauth (~> 1.0.0)
|
160
160
|
omniauth-facebook
|
@@ -164,4 +164,4 @@ DEPENDENCIES
|
|
164
164
|
rdoc
|
165
165
|
ruby-debug (>= 0.10.3)
|
166
166
|
sqlite3
|
167
|
-
webrat (= 0.7.
|
167
|
+
webrat (= 0.7.3)
|
data/lib/devise.rb
CHANGED
@@ -51,6 +51,10 @@ module Devise
|
|
51
51
|
mattr_accessor :stretches
|
52
52
|
@@stretches = 10
|
53
53
|
|
54
|
+
# The default key used when authenticating over http auth.
|
55
|
+
mattr_accessor :http_authentication_key
|
56
|
+
@@http_authentication_key = nil
|
57
|
+
|
54
58
|
# Keys used when authenticating a user.
|
55
59
|
mattr_accessor :authentication_keys
|
56
60
|
@@authentication_keys = [ :email ]
|
@@ -102,6 +106,7 @@ module Devise
|
|
102
106
|
@@extend_remember_period = false
|
103
107
|
|
104
108
|
# Time interval you can access your account before confirming your account.
|
109
|
+
# nil - allows unconfirmed access for unlimited time
|
105
110
|
mattr_accessor :allow_unconfirmed_access_for
|
106
111
|
@@allow_unconfirmed_access_for = 0.days
|
107
112
|
|
@@ -310,7 +315,7 @@ module Devise
|
|
310
315
|
# == Options:
|
311
316
|
#
|
312
317
|
# +model+ - String representing the load path to a custom *model* for this module (to autoload.)
|
313
|
-
# +controller+ - Symbol representing the name of an
|
318
|
+
# +controller+ - Symbol representing the name of an existing or custom *controller* for this module.
|
314
319
|
# +route+ - Symbol representing the named *route* helper for this module.
|
315
320
|
# +strategy+ - Symbol representing if this module got a custom *strategy*.
|
316
321
|
#
|
@@ -420,6 +425,17 @@ module Devise
|
|
420
425
|
|
421
426
|
Devise.mappings.each_value do |mapping|
|
422
427
|
warden_config.scope_defaults mapping.name, :strategies => mapping.strategies
|
428
|
+
|
429
|
+
warden_config.serialize_into_session(mapping.name) do |record|
|
430
|
+
mapping.to.serialize_into_session(record)
|
431
|
+
end
|
432
|
+
|
433
|
+
warden_config.serialize_from_session(mapping.name) do |key|
|
434
|
+
# Previous versions contained an additional entry at the beginning of
|
435
|
+
# key with the record's class name.
|
436
|
+
args = key[-2, 2]
|
437
|
+
mapping.to.serialize_from_session(*args)
|
438
|
+
end
|
423
439
|
end
|
424
440
|
|
425
441
|
@@warden_config_block.try :call, Devise.warden_config
|
@@ -427,7 +443,7 @@ module Devise
|
|
427
443
|
end
|
428
444
|
end
|
429
445
|
|
430
|
-
# Generate a friendly string
|
446
|
+
# Generate a friendly string randomly to be used as token.
|
431
447
|
def self.friendly_token
|
432
448
|
SecureRandom.base64(15).tr('+/=lIO0', 'pqrsxyz')
|
433
449
|
end
|
@@ -54,8 +54,9 @@ module Devise
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def mailer_sender(mapping, sender = :from)
|
57
|
-
|
58
|
-
|
57
|
+
default_sender = default_params[sender]
|
58
|
+
if default_sender.present?
|
59
|
+
default_sender.respond_to?(:to_proc) ? instance_eval(&default_sender) : default_sender
|
59
60
|
elsif Devise.mailer_sender.is_a?(Proc)
|
60
61
|
Devise.mailer_sender.call(mapping.name)
|
61
62
|
else
|
@@ -64,12 +65,12 @@ module Devise
|
|
64
65
|
end
|
65
66
|
|
66
67
|
def template_paths
|
67
|
-
template_path =
|
68
|
+
template_path = _prefixes.dup
|
68
69
|
template_path.unshift "#{@devise_mapping.scoped_path}/mailer" if self.class.scoped_views?
|
69
70
|
template_path
|
70
71
|
end
|
71
72
|
|
72
|
-
# Setup a subject doing an I18n lookup. At first, it
|
73
|
+
# Setup a subject doing an I18n lookup. At first, it attempts to set a subject
|
73
74
|
# based on the current mapping:
|
74
75
|
#
|
75
76
|
# en:
|
@@ -10,12 +10,15 @@ module Devise
|
|
10
10
|
#
|
11
11
|
# * +authentication_keys+: parameters used for authentication. By default [:email].
|
12
12
|
#
|
13
|
+
# * +http_authentication_key+: map the username passed via HTTP Auth to this parameter. Defaults to
|
14
|
+
# the first element in +authentication_keys+.
|
15
|
+
#
|
13
16
|
# * +request_keys+: parameters from the request object used for authentication.
|
14
17
|
# By specifying a symbol (which should be a request method), it will automatically be
|
15
18
|
# passed to find_for_authentication method and considered in your model lookup.
|
16
19
|
#
|
17
20
|
# For instance, if you set :request_keys to [:subdomain], :subdomain will be considered
|
18
|
-
# as key on authentication. This can also be a hash where the value is a boolean
|
21
|
+
# as key on authentication. This can also be a hash where the value is a boolean specifying
|
19
22
|
# if the value is required or not.
|
20
23
|
#
|
21
24
|
# * +http_authenticatable+: if this model allows http authentication. By default true.
|
@@ -32,7 +35,7 @@ module Devise
|
|
32
35
|
# == active_for_authentication?
|
33
36
|
#
|
34
37
|
# After authenticating a user and in each request, Devise checks if your model is active by
|
35
|
-
# calling model.active_for_authentication?. This method is
|
38
|
+
# calling model.active_for_authentication?. This method is overwritten by other devise modules. For instance,
|
36
39
|
# :confirmable overwrites .active_for_authentication? to only return true if your model was confirmed.
|
37
40
|
#
|
38
41
|
# You overwrite this method yourself, but if you do, don't forget to call super:
|
@@ -140,14 +143,26 @@ module Devise
|
|
140
143
|
#
|
141
144
|
# protected
|
142
145
|
#
|
143
|
-
# def send_devise_notification(notification)
|
144
|
-
#
|
146
|
+
# def send_devise_notification(notification, opts = {})
|
147
|
+
# # if the record is new or changed then delay the
|
148
|
+
# # delivery until the after_commit callback otherwise
|
149
|
+
# # send now because after_commit will not be called.
|
150
|
+
# if new_record? || changed?
|
151
|
+
# pending_notifications << [notification, opts]
|
152
|
+
# else
|
153
|
+
# devise_mailer.send(notification, self, opts).deliver
|
154
|
+
# end
|
145
155
|
# end
|
146
156
|
#
|
147
157
|
# def send_pending_notifications
|
148
|
-
# pending_notifications.each do |n|
|
149
|
-
# devise_mailer.send(n, self).deliver
|
158
|
+
# pending_notifications.each do |n, opts|
|
159
|
+
# devise_mailer.send(n, self, opts).deliver
|
150
160
|
# end
|
161
|
+
#
|
162
|
+
# # Empty the pending notifications array because the
|
163
|
+
# # after_commit hook can be called multiple times which
|
164
|
+
# # could cause multiple emails to be sent.
|
165
|
+
# pending_notifications.clear
|
151
166
|
# end
|
152
167
|
#
|
153
168
|
# def pending_notifications
|
@@ -182,7 +197,8 @@ module Devise
|
|
182
197
|
|
183
198
|
module ClassMethods
|
184
199
|
Devise::Models.config(self, :authentication_keys, :request_keys, :strip_whitespace_keys,
|
185
|
-
:case_insensitive_keys, :http_authenticatable, :params_authenticatable, :skip_session_storage
|
200
|
+
:case_insensitive_keys, :http_authenticatable, :params_authenticatable, :skip_session_storage,
|
201
|
+
:http_authentication_key)
|
186
202
|
|
187
203
|
def serialize_into_session(record)
|
188
204
|
[record.to_key, record.authenticatable_salt]
|
@@ -215,7 +231,7 @@ module Devise
|
|
215
231
|
# Example:
|
216
232
|
#
|
217
233
|
# def self.find_for_authentication(tainted_conditions)
|
218
|
-
# find_first_by_auth_conditions(tainted_conditions, active
|
234
|
+
# find_first_by_auth_conditions(tainted_conditions, :active => true)
|
219
235
|
# end
|
220
236
|
#
|
221
237
|
# Finally, notice that Devise also queries for users in other scenarios
|
@@ -34,11 +34,18 @@ module Devise
|
|
34
34
|
|
35
35
|
included do
|
36
36
|
before_create :generate_confirmation_token, :if => :confirmation_required?
|
37
|
-
after_create :send_on_create_confirmation_instructions, :if => :
|
37
|
+
after_create :send_on_create_confirmation_instructions, :if => :send_confirmation_notification?
|
38
38
|
before_update :postpone_email_change_until_confirmation, :if => :postpone_email_change?
|
39
39
|
after_update :send_confirmation_instructions, :if => :reconfirmation_required?
|
40
40
|
end
|
41
41
|
|
42
|
+
def initialize(*args, &block)
|
43
|
+
@bypass_postpone = false
|
44
|
+
@reconfirmation_required = false
|
45
|
+
@skip_confirmation_notification = false
|
46
|
+
super
|
47
|
+
end
|
48
|
+
|
42
49
|
def self.required_fields(klass)
|
43
50
|
required_methods = [:confirmation_token, :confirmed_at, :confirmation_sent_at]
|
44
51
|
required_methods << :unconfirmed_email if klass.reconfirmable
|
@@ -119,6 +126,12 @@ module Devise
|
|
119
126
|
self.confirmed_at = Time.now.utc
|
120
127
|
end
|
121
128
|
|
129
|
+
# Skips sending the confirmation notification email after_create. Unlike
|
130
|
+
# #skip_confirmation!, record still requires confirmation.
|
131
|
+
def skip_confirmation_notification!
|
132
|
+
@skip_confirmation_notification = true
|
133
|
+
end
|
134
|
+
|
122
135
|
# If you don't want reconfirmation to be sent, neither a code
|
123
136
|
# to be generated, call skip_reconfirmation!
|
124
137
|
def skip_reconfirmation!
|
@@ -158,8 +171,11 @@ module Devise
|
|
158
171
|
# # allow_unconfirmed_access_for = 0.days
|
159
172
|
# confirmation_period_valid? # will always return false
|
160
173
|
#
|
174
|
+
# # allow_unconfirmed_access_for = nil
|
175
|
+
# confirmation_period_valid? # will always return true
|
176
|
+
#
|
161
177
|
def confirmation_period_valid?
|
162
|
-
confirmation_sent_at && confirmation_sent_at.utc >= self.class.allow_unconfirmed_access_for.ago
|
178
|
+
self.class.allow_unconfirmed_access_for.nil? || (confirmation_sent_at && confirmation_sent_at.utc >= self.class.allow_unconfirmed_access_for.ago)
|
163
179
|
end
|
164
180
|
|
165
181
|
# Checks if the user confirmation happens before the token becomes invalid
|
@@ -212,7 +228,7 @@ module Devise
|
|
212
228
|
|
213
229
|
def postpone_email_change?
|
214
230
|
postpone = self.class.reconfirmable && email_changed? && !@bypass_postpone
|
215
|
-
@bypass_postpone =
|
231
|
+
@bypass_postpone = false
|
216
232
|
postpone
|
217
233
|
end
|
218
234
|
|
@@ -220,6 +236,10 @@ module Devise
|
|
220
236
|
self.class.reconfirmable && @reconfirmation_required
|
221
237
|
end
|
222
238
|
|
239
|
+
def send_confirmation_notification?
|
240
|
+
confirmation_required? && !@skip_confirmation_notification
|
241
|
+
end
|
242
|
+
|
223
243
|
module ClassMethods
|
224
244
|
# Attempt to find a user by its email. If a record is found, send new
|
225
245
|
# confirmation instructions to it. If not, try searching for a user by unconfirmed_email
|
@@ -95,6 +95,21 @@ module Devise
|
|
95
95
|
result
|
96
96
|
end
|
97
97
|
|
98
|
+
# Destroy record when :current_password matches, otherwise returns
|
99
|
+
# error on :current_password. It also automatically rejects
|
100
|
+
# :current_password if it is blank.
|
101
|
+
def destroy_with_password(current_password)
|
102
|
+
result = if valid_password?(current_password)
|
103
|
+
destroy
|
104
|
+
else
|
105
|
+
self.valid?
|
106
|
+
self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)
|
107
|
+
false
|
108
|
+
end
|
109
|
+
|
110
|
+
result
|
111
|
+
end
|
112
|
+
|
98
113
|
def after_database_authentication
|
99
114
|
end
|
100
115
|
|
@@ -8,7 +8,7 @@ module Devise
|
|
8
8
|
#
|
9
9
|
# Oauthable adds the following options to devise_for:
|
10
10
|
#
|
11
|
-
# * +omniauth_providers+: Which providers are
|
11
|
+
# * +omniauth_providers+: Which providers are available to this model. It expects an array:
|
12
12
|
#
|
13
13
|
# devise_for :database_authenticatable, :omniauthable, :omniauth_providers => [:twitter]
|
14
14
|
#
|
@@ -24,4 +24,4 @@ module Devise
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|