devise 1.0.7 → 1.0.8
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 +9 -0
- data/README.rdoc +4 -2
- data/generators/devise/templates/model.rb +1 -1
- data/lib/devise/controllers/helpers.rb +7 -1
- data/lib/devise/models/confirmable.rb +2 -1
- data/lib/devise/orm/mongo_mapper.rb +7 -2
- data/lib/devise/version.rb +1 -1
- data/test/controllers/helpers_test.rb +7 -0
- data/test/models/confirmable_test.rb +16 -0
- metadata +70 -4
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 1.0.8
|
2
|
+
|
3
|
+
* enhancements
|
4
|
+
* Support for latest MongoMapper
|
5
|
+
* Added anybody_signed_in? helper (by github.com/SSDany)
|
6
|
+
|
7
|
+
* bug fix
|
8
|
+
* confirmation_required? is properly honored on active? calls. (by github.com/paulrosania)
|
9
|
+
|
1
10
|
== 1.0.7
|
2
11
|
|
3
12
|
* bug fix
|
data/README.rdoc
CHANGED
@@ -36,7 +36,7 @@ Install warden gem if you don't have it installed:
|
|
36
36
|
|
37
37
|
Install devise gem:
|
38
38
|
|
39
|
-
sudo gem install devise --version=1.0.
|
39
|
+
sudo gem install devise --version=1.0.7
|
40
40
|
|
41
41
|
Configure warden and devise gems inside your app:
|
42
42
|
|
@@ -247,7 +247,9 @@ Please refer to TODO file.
|
|
247
247
|
|
248
248
|
== Contributors
|
249
249
|
|
250
|
-
We have a long running list of contributors. Check them
|
250
|
+
We have a long running list of contributors. Check them all here:
|
251
|
+
|
252
|
+
http://github.com/plataformatec/devise/contributors
|
251
253
|
|
252
254
|
== Bugs and Feedback
|
253
255
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class <%= class_name %> < ActiveRecord::Base
|
2
2
|
# Include default devise modules. Others available are:
|
3
3
|
# :http_authenticatable, :token_authenticatable, :confirmable, :lockable, :timeoutable and :activatable
|
4
|
-
devise :registerable, :
|
4
|
+
devise :registerable, :database_authenticatable, :recoverable,
|
5
5
|
:rememberable, :trackable, :validatable
|
6
6
|
|
7
7
|
# Setup accessible (or protected) attributes for your model
|
@@ -5,7 +5,7 @@ module Devise
|
|
5
5
|
|
6
6
|
def self.included(base)
|
7
7
|
base.class_eval do
|
8
|
-
helper_method :warden, :signed_in?, :devise_controller?,
|
8
|
+
helper_method :warden, :signed_in?, :devise_controller?, :anybody_signed_in?,
|
9
9
|
*Devise.mappings.keys.map { |m| [:"current_#{m}", :"#{m}_signed_in?", :"#{m}_session"] }.flatten
|
10
10
|
|
11
11
|
# Use devise default_url_options. We have to declare it here to overwrite
|
@@ -48,6 +48,12 @@ module Devise
|
|
48
48
|
warden.authenticate?(:scope => scope)
|
49
49
|
end
|
50
50
|
|
51
|
+
# Check if the any scope is signed in session, without running
|
52
|
+
# authentication hooks.
|
53
|
+
def anybody_signed_in?
|
54
|
+
Devise.mappings.keys.any? { |scope| signed_in?(scope) }
|
55
|
+
end
|
56
|
+
|
51
57
|
# Sign in an user that already was authenticated. This helper is useful for logging
|
52
58
|
# users in after sign up.
|
53
59
|
#
|
@@ -57,6 +57,7 @@ module Devise
|
|
57
57
|
|
58
58
|
# Send confirmation instructions by email
|
59
59
|
def send_confirmation_instructions
|
60
|
+
generate_confirmation_token if self.confirmation_token.nil?
|
60
61
|
::DeviseMailer.deliver_confirmation_instructions(self)
|
61
62
|
end
|
62
63
|
|
@@ -70,7 +71,7 @@ module Devise
|
|
70
71
|
# is already confirmed, it should never be blocked. Otherwise we need to
|
71
72
|
# calculate if the confirm time has not expired for this user.
|
72
73
|
def active?
|
73
|
-
super && (confirmed? || confirmation_period_valid?)
|
74
|
+
super && (!confirmation_required? || confirmed? || confirmation_period_valid?)
|
74
75
|
end
|
75
76
|
|
76
77
|
# The message to be shown if the account is inactive.
|
@@ -43,5 +43,10 @@ module Devise
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
MongoMapper::
|
47
|
-
MongoMapper::
|
46
|
+
if MongoMapper::Version >= "0.8.0"
|
47
|
+
MongoMapper::Plugins::Document::ClassMethods.send(:include, Devise::Models)
|
48
|
+
MongoMapper::Plugins::EmbeddedDocument::ClassMethods.send(:include, Devise::Models)
|
49
|
+
else
|
50
|
+
MongoMapper::Document::ClassMethods.send(:include, Devise::Models)
|
51
|
+
MongoMapper::EmbeddedDocument::ClassMethods.send(:include, Devise::Models)
|
52
|
+
end
|
data/lib/devise/version.rb
CHANGED
@@ -36,6 +36,13 @@ class ControllerAuthenticableTest < ActionController::TestCase
|
|
36
36
|
@controller.signed_in?(:my_scope)
|
37
37
|
end
|
38
38
|
|
39
|
+
test 'proxy anybody_signed_in? to signed_in?' do
|
40
|
+
Devise.mappings.keys.each { |scope| # :user, :admin, :manager
|
41
|
+
@controller.expects(:signed_in?).with(scope)
|
42
|
+
}
|
43
|
+
@controller.anybody_signed_in?
|
44
|
+
end
|
45
|
+
|
39
46
|
test 'proxy current_admin to authenticate with admin scope' do
|
40
47
|
@mock_warden.expects(:authenticate).with(:scope => :admin)
|
41
48
|
@controller.current_admin
|
@@ -134,6 +134,14 @@ class ConfirmableTest < ActiveSupport::TestCase
|
|
134
134
|
User.send_confirmation_instructions(:email => user.email)
|
135
135
|
end
|
136
136
|
end
|
137
|
+
|
138
|
+
test 'should always have confirmation token when email is sent' do
|
139
|
+
user = new_user
|
140
|
+
user.instance_eval { def confirmation_required?; false end }
|
141
|
+
user.save
|
142
|
+
user.send_confirmation_instructions
|
143
|
+
assert_not_nil user.confirmation_token
|
144
|
+
end
|
137
145
|
|
138
146
|
test 'should not resend email instructions if the user change his email' do
|
139
147
|
user = create_user
|
@@ -209,4 +217,12 @@ class ConfirmableTest < ActiveSupport::TestCase
|
|
209
217
|
user.save
|
210
218
|
assert_not user.reload.active?
|
211
219
|
end
|
220
|
+
|
221
|
+
test 'should be active without confirmation when confirmation is not required' do
|
222
|
+
user = create_user
|
223
|
+
user.instance_eval { def confirmation_required?; false end }
|
224
|
+
user.confirmation_sent_at = nil
|
225
|
+
user.save
|
226
|
+
assert user.reload.active?
|
227
|
+
end
|
212
228
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 8
|
10
|
+
version: 1.0.8
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- "Jos\xC3\xA9 Valim"
|
@@ -15,16 +16,18 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-06-23 00:00:00 +02:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: warden
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
28
|
- - ~>
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 49
|
28
31
|
segments:
|
29
32
|
- 0
|
30
33
|
- 10
|
@@ -121,6 +124,65 @@ files:
|
|
121
124
|
- lib/devise/test_helpers.rb
|
122
125
|
- lib/devise/version.rb
|
123
126
|
- rails/init.rb
|
127
|
+
- test/controllers/helpers_test.rb
|
128
|
+
- test/controllers/internal_helpers_test.rb
|
129
|
+
- test/controllers/url_helpers_test.rb
|
130
|
+
- test/devise_test.rb
|
131
|
+
- test/encryptors_test.rb
|
132
|
+
- test/failure_app_test.rb
|
133
|
+
- test/integration/authenticatable_test.rb
|
134
|
+
- test/integration/confirmable_test.rb
|
135
|
+
- test/integration/http_authenticatable_test.rb
|
136
|
+
- test/integration/lockable_test.rb
|
137
|
+
- test/integration/rack_middleware_test.rb
|
138
|
+
- test/integration/recoverable_test.rb
|
139
|
+
- test/integration/registerable_test.rb
|
140
|
+
- test/integration/rememberable_test.rb
|
141
|
+
- test/integration/timeoutable_test.rb
|
142
|
+
- test/integration/token_authenticatable_test.rb
|
143
|
+
- test/integration/trackable_test.rb
|
144
|
+
- test/mailers/confirmation_instructions_test.rb
|
145
|
+
- test/mailers/reset_password_instructions_test.rb
|
146
|
+
- test/mailers/unlock_instructions_test.rb
|
147
|
+
- test/mapping_test.rb
|
148
|
+
- test/models/authenticatable_test.rb
|
149
|
+
- test/models/confirmable_test.rb
|
150
|
+
- test/models/lockable_test.rb
|
151
|
+
- test/models/recoverable_test.rb
|
152
|
+
- test/models/rememberable_test.rb
|
153
|
+
- test/models/timeoutable_test.rb
|
154
|
+
- test/models/token_authenticatable_test.rb
|
155
|
+
- test/models/trackable_test.rb
|
156
|
+
- test/models/validatable_test.rb
|
157
|
+
- test/models_test.rb
|
158
|
+
- test/orm/active_record.rb
|
159
|
+
- test/orm/mongo_mapper.rb
|
160
|
+
- test/rails_app/app/active_record/admin.rb
|
161
|
+
- test/rails_app/app/active_record/user.rb
|
162
|
+
- test/rails_app/app/controllers/admins_controller.rb
|
163
|
+
- test/rails_app/app/controllers/application_controller.rb
|
164
|
+
- test/rails_app/app/controllers/home_controller.rb
|
165
|
+
- test/rails_app/app/controllers/users_controller.rb
|
166
|
+
- test/rails_app/app/helpers/application_helper.rb
|
167
|
+
- test/rails_app/app/mongo_mapper/admin.rb
|
168
|
+
- test/rails_app/app/mongo_mapper/user.rb
|
169
|
+
- test/rails_app/config/boot.rb
|
170
|
+
- test/rails_app/config/environment.rb
|
171
|
+
- test/rails_app/config/environments/development.rb
|
172
|
+
- test/rails_app/config/environments/production.rb
|
173
|
+
- test/rails_app/config/environments/test.rb
|
174
|
+
- test/rails_app/config/initializers/devise.rb
|
175
|
+
- test/rails_app/config/initializers/inflections.rb
|
176
|
+
- test/rails_app/config/initializers/new_rails_defaults.rb
|
177
|
+
- test/rails_app/config/initializers/session_store.rb
|
178
|
+
- test/rails_app/config/routes.rb
|
179
|
+
- test/routes_test.rb
|
180
|
+
- test/support/assertions_helper.rb
|
181
|
+
- test/support/integration_tests_helper.rb
|
182
|
+
- test/support/test_silencer.rb
|
183
|
+
- test/support/tests_helper.rb
|
184
|
+
- test/test_helper.rb
|
185
|
+
- test/test_helpers_test.rb
|
124
186
|
has_rdoc: true
|
125
187
|
homepage: http://github.com/plataformatec/devise
|
126
188
|
licenses: []
|
@@ -131,23 +193,27 @@ rdoc_options:
|
|
131
193
|
require_paths:
|
132
194
|
- lib
|
133
195
|
required_ruby_version: !ruby/object:Gem::Requirement
|
196
|
+
none: false
|
134
197
|
requirements:
|
135
198
|
- - ">="
|
136
199
|
- !ruby/object:Gem::Version
|
200
|
+
hash: 3
|
137
201
|
segments:
|
138
202
|
- 0
|
139
203
|
version: "0"
|
140
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
|
+
none: false
|
141
206
|
requirements:
|
142
207
|
- - ">="
|
143
208
|
- !ruby/object:Gem::Version
|
209
|
+
hash: 3
|
144
210
|
segments:
|
145
211
|
- 0
|
146
212
|
version: "0"
|
147
213
|
requirements: []
|
148
214
|
|
149
215
|
rubyforge_project:
|
150
|
-
rubygems_version: 1.3.
|
216
|
+
rubygems_version: 1.3.7
|
151
217
|
signing_key:
|
152
218
|
specification_version: 3
|
153
219
|
summary: Flexible authentication solution for Rails with Warden
|