devise 0.4.2 → 0.4.3

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.

@@ -1,3 +1,9 @@
1
+ == 0.4.3
2
+
3
+ * bug fix
4
+ * [#29] Authentication fail if user cannot be serialized from session;
5
+ * Default configuration values should not overwrite user values;
6
+
1
7
  == 0.4.2
2
8
 
3
9
  * deprecations
data/Rakefile CHANGED
@@ -36,7 +36,7 @@ begin
36
36
  s.description = "Flexible authentication solution for Rails with Warden"
37
37
  s.authors = ['José Valim', 'Carlos Antônio']
38
38
  s.files = FileList["[A-Z]*", "{app,config,generators,lib}/**/*", "init.rb"]
39
- s.add_dependency("warden", "~> 0.5.1")
39
+ s.add_dependency("warden", "~> 0.5.2")
40
40
  end
41
41
 
42
42
  Jeweler::GemcutterTasks.new
@@ -12,17 +12,31 @@ module Devise
12
12
  TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].freeze
13
13
 
14
14
  # Maps the messages types that comes from warden to a flash type.
15
+ # This hash is not frozen, so you can add your messages as well.
15
16
  FLASH_MESSAGES = {
16
17
  :unauthenticated => :success,
17
18
  :unconfirmed => :failure
18
19
  }
19
20
 
20
- # Models configuration
21
- mattr_accessor :pepper, :stretches, :remember_for, :confirm_within
21
+ # Used to encrypt password. Please generate one with rake secret
22
+ mattr_accessor :pepper
23
+ @@pepper = nil
24
+
25
+ # The number of times to encrypt password.
26
+ mattr_accessor :stretches
27
+ @@stretches = 10
28
+
29
+ # Time interval where the remember me token is valid.
30
+ mattr_accessor :remember_for
31
+ @@remember_for = 2.weeks
32
+
33
+ # Time interval you can access your account before confirming your account.
34
+ mattr_accessor :confirm_within
35
+ @@confirm_within = 0.days
22
36
 
23
- # Mappings
37
+ # Store scopes mappings.
24
38
  mattr_accessor :mappings
25
- self.mappings = {}
39
+ @@mappings = {}
26
40
 
27
41
  class << self
28
42
  # Default way to setup Devise. Run script/generate devise_install to create
@@ -76,4 +90,4 @@ module Devise
76
90
  end
77
91
 
78
92
  require 'devise/warden'
79
- require 'devise/rails'
93
+ require 'devise/rails'
@@ -16,9 +16,7 @@ module Devise
16
16
  # To add the class methods you need to have a module ClassMethods defined
17
17
  # inside the given class.
18
18
  #
19
- def self.config(mod, accessor, default=nil) #:nodoc:
20
- Devise.send :"#{accessor}=", default
21
-
19
+ def self.config(mod, accessor) #:nodoc:
22
20
  mod.class_eval <<-METHOD, __FILE__, __LINE__
23
21
  def #{accessor}
24
22
  self.class.#{accessor}
@@ -91,7 +91,7 @@ module Devise
91
91
  end
92
92
 
93
93
  Devise::Models.config(self, :pepper)
94
- Devise::Models.config(self, :stretches, 10)
94
+ Devise::Models.config(self, :stretches)
95
95
  end
96
96
  end
97
97
  end
@@ -150,7 +150,7 @@ module Devise
150
150
  end
151
151
  end
152
152
 
153
- Devise::Models.config(self, :confirm_within, 0.days)
153
+ Devise::Models.config(self, :confirm_within)
154
154
  end
155
155
  end
156
156
  end
@@ -89,7 +89,7 @@ module Devise
89
89
  end
90
90
  end
91
91
 
92
- Devise::Models.config(self, :remember_for, 2.weeks)
92
+ Devise::Models.config(self, :remember_for)
93
93
  end
94
94
  end
95
95
  end
@@ -1,3 +1,3 @@
1
1
  module Devise
2
- VERSION = "0.4.2".freeze
2
+ VERSION = "0.4.3".freeze
3
3
  end
@@ -13,7 +13,7 @@ Warden::Manager.serialize_into_session{ |user| [user.class, user.id] }
13
13
  # Session Serialization out. This block gets the user out of the session.
14
14
  # It should be the reverse of serializing the object into the session
15
15
  Warden::Manager.serialize_from_session do |klass, id|
16
- klass.find(id)
16
+ klass.find_by_id(id)
17
17
  end
18
18
 
19
19
  # Setup devise strategies for Warden
@@ -184,4 +184,12 @@ class AuthenticationTest < ActionController::IntegrationTest
184
184
  visit 'users/index'
185
185
  assert_equal "Cart", @controller.user_session[:cart]
186
186
  end
187
+
188
+ test 'destroyed account is logged out' do
189
+ sign_in_as_user
190
+ visit 'users/index'
191
+ User.destroy_all
192
+ visit 'users/index'
193
+ assert_redirected_to '/users/sign_in?unauthenticated=true'
194
+ end
187
195
  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.2
4
+ version: 0.4.3
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-06 00:00:00 -02:00
13
+ date: 2009-11-10 00:00:00 -02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 0.5.1
24
+ version: 0.5.2
25
25
  version:
26
26
  description: Flexible authentication solution for Rails with Warden
27
27
  email: contact@plataformatec.com.br
@@ -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/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
132
- - test/controllers/url_helpers_test.rb
133
- - test/controllers/helpers_test.rb
134
115
  - test/controllers/filters_test.rb
135
- - test/models_test.rb
116
+ - test/controllers/helpers_test.rb
117
+ - test/controllers/url_helpers_test.rb
118
+ - test/devise_test.rb
119
+ - test/failure_test.rb
136
120
  - test/integration/authenticatable_test.rb
137
- - test/integration/rememberable_test.rb
138
- - test/integration/recoverable_test.rb
139
121
  - test/integration/confirmable_test.rb
122
+ - test/integration/recoverable_test.rb
123
+ - test/integration/rememberable_test.rb
140
124
  - test/mailers/confirmation_instructions_test.rb
141
125
  - test/mailers/reset_password_instructions_test.rb
126
+ - test/mapping_test.rb
142
127
  - test/models/authenticatable_test.rb
143
- - test/models/rememberable_test.rb
128
+ - test/models/confirmable_test.rb
144
129
  - test/models/recoverable_test.rb
130
+ - test/models/rememberable_test.rb
145
131
  - test/models/validatable_test.rb
146
- - test/models/confirmable_test.rb
147
- - test/failure_test.rb
148
- - test/support/model_tests_helper.rb
132
+ - test/models_test.rb
133
+ - test/rails_app/app/controllers/admins_controller.rb
134
+ - test/rails_app/app/controllers/application_controller.rb
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
149
151
  - test/support/assertions_helper.rb
150
152
  - test/support/integration_tests_helper.rb
151
- - test/devise_test.rb
152
- - test/routes_test.rb
153
+ - test/support/model_tests_helper.rb
153
154
  - test/test_helper.rb
154
- - test/mapping_test.rb