clearance 0.8.6 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of clearance might be problematic. Click here for more details.

@@ -1,10 +1,28 @@
1
- h2. 0.8.6 (unreleased)
1
+ 0.8.7 (02/21/2010)
2
+ ------------------
3
+
4
+ * [#43] Fixed global sign out bug. (Ryan McGreary)
5
+ * [#69] Allow Rails apps to before_filter :authenticate the entire app
6
+ in ApplicationController and still have password recovery work without
7
+ overriding any controllers. (Claudio Poli, Dan Croak)
8
+ * [#72] #[21] Rails3 fix for ActionController/ActionDispatch change.
9
+ (Joseph Holsten, Peter Haza, Dan Croak)
10
+
11
+ 0.8.6 (02/17/2010)
12
+ ------------------
2
13
 
3
14
  * Clearance features capitalization should match view text (Bobby Wilson)
4
- * skip :authenticate before_filter in controllers so apps can easily
15
+ * [#39] skip :authenticate before_filter in controllers so apps can easily
5
16
  authenticate a whole site without subclassing (Matthew Ford)
17
+ * [#45] Added randomness to token and salt generation (Ryan McGeary)
18
+ * [#43] Reset the remember_token on sign out instead of sign in. Allows for the same
19
+ user to sign in from two locations at once. (Ryan McGeary)
20
+ * [#62] Append the version number to generated update migrations (Joe Ferris)
21
+ * Allow overridden user models to skip email/password validations
22
+ conditionally. This makes username/facebook integration easier. (Joe Ferris)
6
23
 
7
- h2. 0.8.5 (01/20/2009)
24
+ 0.8.5 (01/20/2010)
25
+ ------------------
8
26
 
9
27
  * replaced routing hack with Clearance::Routes.draw(map) to give
10
28
  more control to the application developer. (Dan Croak)
@@ -15,36 +33,42 @@ more control to the application developer. (Dan Croak)
15
33
  * use Clearance.configure block to set mailer sender instead of
16
34
  DO_NOT_REPLY constant. (Dan Croak)
17
35
 
18
- h2. 0.8.4 (12/08/2009)
36
+ 0.8.4 (12/08/2009)
37
+ ------------------
19
38
 
20
39
  * [#48] remove unnecessary require 'factory_girl' in generator (Dan Croak)
21
40
  * reference gemcutter (not github) as the gem source in README (Dan Croak)
22
41
  * add IRC, rdoc.info links to README (Dan Croak)
23
42
  * move user confirmation email trigger into model (Chad Pytel)
24
43
 
25
- h2. 0.8.3 (09/21/2009)
44
+ 0.8.3 (09/21/2009)
45
+ ------------------
26
46
 
27
47
  * [#27] remove class_eval in Clearance::Authentication. (Anuj Dutta)
28
48
  * Avoid possible collisions in the remember me token (Joe Ferris)
29
49
 
30
- h2. 0.8.2 (09/01/2009)
50
+ 0.8.2 (09/01/2009)
51
+ ------------------
31
52
 
32
53
  * current_user= accessor method. (Joe Ferris, Josh Clayton)
33
54
  * set current_user in sign_in. (Jon Yurek)
34
55
 
35
- h2. 0.8.1 (08/31/2009)
56
+ 0.8.1 (08/31/2009)
57
+ ------------------
36
58
 
37
59
  * Removed unnecessary remember_token_expires_at column and the
38
60
  remember? and forget_me! user instance methods. (Dan Croak)
39
61
 
40
- h2. 0.8.0 (08/31/2009)
62
+ 0.8.0 (08/31/2009)
63
+ ------------------
41
64
 
42
65
  * Always remember me. Replaced session-and-remember-me authentication with
43
66
  always using a cookie with a long timeout. (Dan Croak)
44
67
  * Documented Clearance::Authentication with YARD. (Dan Croak)
45
68
  * Documented Clearance::User with YARD. (Dan Croak)
46
69
 
47
- h2. 0.7.0 (08/04/2009)
70
+ 0.7.0 (08/04/2009)
71
+ ------------------
48
72
 
49
73
  * Redirect signed in user who clicks confirmation link again. (Dan Croak)
50
74
  * Redirect signed out user who clicks confirmation link again. (Dan Croak)
@@ -53,18 +77,21 @@ Croak)
53
77
  * Added clearance_views generator. By default, creates formtastic views which
54
78
  pass all tests and features. (Dan Croak)
55
79
 
56
- h2. 0.6.9 (07/04/2009)
80
+ 0.6.9 (07/04/2009)
81
+ ------------------
57
82
 
58
83
  * Added timestamps to create users migration. (Dan Croak)
59
84
  * Ready for Ruby 1.9. (Jason Morrison, Nick Quaranto)
60
85
 
61
- h2. 0.6.8 (06/24/2009)
86
+ 0.6.8 (06/24/2009)
87
+ ------------------
62
88
 
63
89
  * Added defined? checks for various Rails constants such as ActionController
64
90
  for easier unit testing of Clearance extensions... particularly ActiveRecord
65
91
  extensions... particularly strong_password. (Dan Croak)
66
92
 
67
- h2. 0.6.7 (06/13/2009)
93
+ 0.6.7 (06/13/2009)
94
+ ------------------
68
95
 
69
96
  * [#30] Added sign_up, sign_in, sign_out named routes. (Dan Croak)
70
97
  * [#22] Minimizing Reek smell: Duplication in redirect_back_or. (Dan Croak)
@@ -76,16 +103,19 @@ Croak)
76
103
  * README improvements. (Dan Croak)
77
104
  * Move routes loading to separate file. (Joshua Clayton)
78
105
 
79
- h2. 0.6.6 (05/18/2009)
106
+ 0.6.6 (05/18/2009)
107
+ ------------------
80
108
 
81
109
  * [#14] replaced class_eval in Clearance::User with modules. This was needed
82
110
  in a thoughtbot client app so we could write our own validations. (Dan Croak)
83
111
 
84
- h2. 0.6.5 (05/17/2009)
112
+ 0.6.5 (05/17/2009)
113
+ ------------------
85
114
 
86
115
  * [#6] Make Clearance i18n aware. (Timur Vafin, Marcel Goerner, Eugene Bolshakov, Dan Croak)
87
116
 
88
- h2. 0.6.4 (05/12/2009)
117
+ 0.6.4 (05/12/2009)
118
+ ------------------
89
119
 
90
120
  * Moved issue tracking to Github from Lighthouse. (Dan Croak)
91
121
  * [#7] asking higher-level questions of controllers in webrat steps, such as signed_in? instead of what's in the session. same for accessors. (Dan Croak)
@@ -93,22 +123,26 @@ h2. 0.6.4 (05/12/2009)
93
123
  * [#13] move private methods on sessions controller into Clearance::Authentication module (Dan Croak)
94
124
  * [#9] audited flash keys. (Dan Croak)
95
125
 
96
- h2. 0.6.3 (04/23/2009)
126
+ 0.6.3 (04/23/2009)
127
+ ------------------
97
128
 
98
129
  * Scoping ClearanceMailer properly within controllers so it works in production environments. (Nick Quaranto)
99
130
 
100
- h2. 0.6.2 (04/22/2009)
131
+ 0.6.2 (04/22/2009)
132
+ ------------------
101
133
 
102
134
  * Insert Clearance::User into User model if it exists. (Nick Quaranto)
103
135
  * World(NavigationHelpers) Cucumber 3.0 style. (Shay Arnett & Mark Cornick)
104
136
 
105
- h2. 0.6.1 (04/21/2009)
137
+ 0.6.1 (04/21/2009)
138
+ ------------------
106
139
 
107
140
  * Scope operators are necessary to keep Rails happy. Reverting the original
108
141
  revert so they're back in the library now for constants referenced inside of
109
142
  the gem. (Nick Quaranto)
110
143
 
111
- h2. 0.6.0 (04/21/2009)
144
+ 0.6.0 (04/21/2009)
145
+ ------------------
112
146
 
113
147
  * Converted Clearance to a Rails engine. (Dan Croak & Joe Ferris)
114
148
  * Include Clearance::User in User model in app. (Dan Croak & Joe Ferris)
@@ -132,33 +166,39 @@ Quaranto)
132
166
  * Made the clearance controllers unloadable to stop constant loading errors in
133
167
  development mode (Nick Quaranto)
134
168
 
135
- h2. 0.5.6 (4/11/2009)
169
+ 0.5.6 (4/11/2009)
170
+ -----------------
136
171
 
137
172
  * [#57] Step definition changed for "User should see error messages" so
138
173
  features won't fail for certain validations. (Nick Quaranto)
139
174
 
140
- h2. 0.5.5 (3/23/2009)
175
+ 0.5.5 (3/23/2009)
176
+ -----------------
141
177
 
142
178
  * Removing duplicate test to get rid of warning. (Nick Quaranto)
143
179
 
144
- h2. 0.5.4 (3/21/2009)
180
+ 0.5.4 (3/21/2009)
181
+ -----------------
145
182
 
146
183
  * When users fail logging in, redirect them instead of rendering. (Matt
147
184
  Jankowski)
148
185
 
149
- h2. 0.5.3 (3/5/2009)
186
+ 0.5.3 (3/5/2009)
187
+ ----------------
150
188
 
151
189
  * Clearance now works with (and requires) Shoulda 2.10.0. (Mark Cornick, Joe
152
190
  Ferris, Dan Croak)
153
191
  * Prefer flat over nested contexts in sessions_controller_test. (Joe Ferris,
154
192
  Dan Croak)
155
193
 
156
- h2. 0.5.2 (3/2/2009)
194
+ 0.5.2 (3/2/2009)
195
+ ----------------
157
196
 
158
197
  * Fixed last remaining errors in Rails 2.3 tests. Now fully compatible. (Joe
159
198
  Ferris, Dan Croak)
160
199
 
161
- h2. 0.5.1 (2/27/2009)
200
+ 0.5.1 (2/27/2009)
201
+ -----------------
162
202
 
163
203
  * [#46] A user with unconfirmed email who resets password now confirms email.
164
204
  (Marcel Görner)
@@ -170,7 +210,8 @@ application.rb in Rails 2.3 apps. (Dan Croak)
170
210
  * [#42] Bug fix. Rack-based session change altered how to test remember me
171
211
  cookie. (Mihai Anca)
172
212
 
173
- h2. 0.5.0 (2/27/2009)
213
+ 0.5.0 (2/27/2009)
214
+ -----------------
174
215
 
175
216
  * Fixed problem with Cucumber features. (Dan Croak)
176
217
  * Fixed mising HTTP fluency use case. (Dan Croak)
@@ -178,7 +219,8 @@ h2. 0.5.0 (2/27/2009)
178
219
  Croak)
179
220
  * Refactored User unit tests to be more readable. (Dan Croak)
180
221
 
181
- h2. 0.4.9 (2/20/2009)
222
+ 0.4.9 (2/20/2009)
223
+ -----------------
182
224
 
183
225
  * Protect passwords & confirmations actions with forbidden filters. (Dan Croak)
184
226
  * Return 403 Forbidden status code in those cases. (Tim Pope)
@@ -188,7 +230,8 @@ h2. 0.4.9 (2/20/2009)
188
230
  * [#45] Fixed bug that allowed anyone to edit another user's password (Marcel Görner)
189
231
  * Required Factory Girl >= 1.2.0. (Dan Croak)
190
232
 
191
- h2. 0.4.8 (2/16/2009)
233
+ 0.4.8 (2/16/2009)
234
+ -----------------
192
235
 
193
236
  * Added support paths for Cucumber. (Ben Mabey)
194
237
  * Added documentation for the flash. (Ben Mabey)
@@ -196,17 +239,20 @@ h2. 0.4.8 (2/16/2009)
196
239
  * Removed interpolated email address from flash message to make i18n easier. (Bence Nagy)
197
240
  * Standardized flash messages that refer to email delivery. (Dan Croak)
198
241
 
199
- h2. 0.4.7 (2/12/2009)
242
+ 0.4.7 (2/12/2009)
243
+ -----------------
200
244
 
201
245
  * Removed Clearance::Test::TestHelper so there is one less setup step. (Dan Croak)
202
246
  * All test helpers now in shoulda_macros. (Dan Croak)
203
247
 
204
- h2. 0.4.6 (2/11/2009)
248
+ 0.4.6 (2/11/2009)
249
+ -----------------
205
250
 
206
251
  * Made the modules behave like mixins again. (hat-tip Eloy Duran)
207
252
  * Created Actions and PrivateMethods modules on controllers for future RDoc reasons. (Dan Croak, Joe Ferris)
208
253
 
209
- h2. 0.4.5 (2/9/2009)
254
+ 0.4.5 (2/9/2009)
255
+ ----------------
210
256
 
211
257
  * [#43] Removed email downcasing because local-part is case sensitive per RFC5321. (Dan Croak)
212
258
  * [#42] Removed dependency on Mocha. (Dan Croak)
@@ -217,7 +263,8 @@ h2. 0.4.5 (2/9/2009)
217
263
  * Audited "sign up" naming convention. "Register" had slipped in a few places. (Dan Croak)
218
264
  * Switched to SHA1 encryption. Cypher doesn't matter much for email confirmation, password reset. Better to have shorter hashes in the emails for clients who line break on 72 chars. (Dan Croak)
219
265
 
220
- h2. 0.4.4 (2/2/2009)
266
+ 0.4.4 (2/2/2009)
267
+ ----------------
221
268
 
222
269
  * Added a generator for Cucumber features. (Joe Ferris, Dan Croak)
223
270
  * Standarized naming for "Sign up," "Sign in," and "Sign out". (Dan Croak)
data/README.md CHANGED
@@ -67,7 +67,7 @@ To change any of provided actions, subclass a Clearance controller...
67
67
 
68
68
  and add your route above (before) Clearance routes in config/routes.rb:
69
69
 
70
- map.resource :session, :controller => 'clearance/sessions'
70
+ map.resource :session, :controller => 'sessions'
71
71
 
72
72
  See lib/clearance/routes.rb for all the routes Clearance provides.
73
73
 
@@ -126,4 +126,4 @@ Dan Croak, Mike Burns, Jason Morrison, Joe Ferris, Eugene Bolshakov,
126
126
  Nick Quaranto, Josh Nichols, Mike Breen, Marcel Görner, Bence Nagy, Ben Mabey,
127
127
  Eloy Duran, Tim Pope, Mihai Anca, Mark Cornick, Shay Arnett, Joshua Clayton,
128
128
  Mustafa Ekim, Jon Yurek, Anuj Dutta, Chad Pytel, Ben Orenstein, Bobby Wilson,
129
- and Matthew Ford.
129
+ Matthew Ford, Ryan McGeary, Claudio Poli, Joseph Holsten, and Peter Haza.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.6
1
+ 0.8.7
@@ -1,7 +1,7 @@
1
1
  class Clearance::PasswordsController < ApplicationController
2
2
  unloadable
3
3
 
4
- skip_before_filter :authenticate, :only => [:edit, :update]
4
+ skip_before_filter :authenticate, :only => [:new, :create, :edit, :update]
5
5
  before_filter :forbid_missing_token, :only => [:edit, :update]
6
6
  before_filter :forbid_non_existent_user, :only => [:edit, :update]
7
7
  filter_parameter_logging :password, :password_confirmation
@@ -33,6 +33,12 @@ class ClearanceGenerator < Rails::Generator::Base
33
33
  end
34
34
  end
35
35
 
36
+ def schema_version_constant
37
+ if upgrading_clearance_again?
38
+ "To#{schema_version.gsub('_', '')}"
39
+ end
40
+ end
41
+
36
42
  private
37
43
 
38
44
  def migration_source_name
@@ -44,7 +50,7 @@ class ClearanceGenerator < Rails::Generator::Base
44
50
  end
45
51
 
46
52
  def migration_target_name
47
- if ActiveRecord::Base.connection.table_exists?(:users)
53
+ if upgrading_clearance_again?
48
54
  "update_users_to_#{schema_version}"
49
55
  else
50
56
  'create_users'
@@ -55,4 +61,8 @@ class ClearanceGenerator < Rails::Generator::Base
55
61
  IO.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).strip.gsub(/[^\d]/, '_')
56
62
  end
57
63
 
64
+ def upgrading_clearance_again?
65
+ ActiveRecord::Base.connection.table_exists?(:users)
66
+ end
67
+
58
68
  end
@@ -1,14 +1,14 @@
1
- class ClearanceUpdateUsers < ActiveRecord::Migration
1
+ class ClearanceUpdateUsers<%= schema_version_constant %> < ActiveRecord::Migration
2
2
  def self.up
3
3
  <%
4
4
  existing_columns = ActiveRecord::Base.connection.columns(:users).collect { |each| each.name }
5
5
  columns = [
6
6
  [:email, 't.string :email'],
7
7
  [:encrypted_password, 't.string :encrypted_password, :limit => 128'],
8
- [:salt, 't.string :salt, :limit => 128'],
8
+ [:salt, 't.string :salt, :limit => 128'],
9
9
  [:confirmation_token, 't.string :confirmation_token, :limit => 128'],
10
- [:remember_token, 't.string :remember_token, :limit => 128'],
11
- [:email_confirmed, 't.boolean :email_confirmed, :default => false, :null => false']
10
+ [:remember_token, 't.string :remember_token, :limit => 128'],
11
+ [:email_confirmed, 't.boolean :email_confirmed, :default => false, :null => false']
12
12
  ].delete_if {|c| existing_columns.include?(c.first.to_s)}
13
13
  -%>
14
14
  change_table(:users) do |t|
@@ -22,8 +22,8 @@ class ClearanceUpdateUsers < ActiveRecord::Migration
22
22
  index_names = existing_indexes.collect { |each| each.name }
23
23
  new_indexes = [
24
24
  [:index_users_on_id_and_confirmation_token, 'add_index :users, [:id, :confirmation_token]'],
25
- [:index_users_on_email, 'add_index :users, :email'],
26
- [:index_users_on_remember_token, 'add_index :users, :remember_token']
25
+ [:index_users_on_email, 'add_index :users, :email'],
26
+ [:index_users_on_remember_token, 'add_index :users, :remember_token']
27
27
  ].delete_if { |each| index_names.include?(each.first.to_s) }
28
28
  -%>
29
29
  <% new_indexes.each do |each| -%>
@@ -75,8 +75,8 @@ module Clearance
75
75
  # @example
76
76
  # sign_out
77
77
  def sign_out
78
- cookies.delete(:remember_token)
79
78
  current_user.reset_remember_token! if current_user
79
+ cookies.delete(:remember_token)
80
80
  current_user = nil
81
81
  end
82
82
 
@@ -1,3 +1,5 @@
1
- if defined?(ActionController::Base)
1
+ if defined?(ActionDispatch::ShowExceptions) # Rails 3
2
+ ActionDispatch::ShowExceptions.rescue_responses.update('ActionController::Forbidden' => :forbidden)
3
+ elsif defined?(ActionController::Base)
2
4
  ActionController::Base.rescue_responses.update('ActionController::Forbidden' => :forbidden)
3
5
  end
@@ -65,11 +65,11 @@ module Clearance
65
65
  # salt, token, password encryption are handled before_save.
66
66
  def self.included(model)
67
67
  model.class_eval do
68
- before_save :initialize_salt,
69
- :encrypt_password
68
+ before_save :initialize_salt,
69
+ :encrypt_password
70
70
  before_create :generate_confirmation_token,
71
71
  :generate_remember_token
72
- after_create :send_confirmation_email, :unless => :email_confirmed?
72
+ after_create :send_confirmation_email, :unless => :email_confirmed?
73
73
  end
74
74
  end
75
75
  end
@@ -123,8 +123,7 @@ class SessionsControllerTest < ActionController::TestCase
123
123
  setup do
124
124
  @user = Factory(:email_confirmed_user)
125
125
  @user.update_attribute(:remember_token, "old-token")
126
- cookies['remember_token'] = CGI::Cookie.new('token', 'value')
127
- sign_in_as @user
126
+ @request.cookies["remember_token"] = "old-token"
128
127
  delete :destroy
129
128
  end
130
129
 
@@ -2,4 +2,5 @@ class ApplicationController < ActionController::Base
2
2
  helper :all
3
3
  protect_from_forgery
4
4
  include Clearance::Authentication
5
+ before_filter :authenticate
5
6
  end
@@ -0,0 +1,8 @@
1
+ # This simulates loading the clearance gem, but without relying on
2
+ # vendor/gems
3
+
4
+ clearance_path = File.join(File.dirname(__FILE__), *%w(.. .. .. ..))
5
+ clearance_lib_path = File.join(clearance_path, "lib")
6
+
7
+ $LOAD_PATH.unshift(clearance_lib_path)
8
+ load File.join(clearance_path, 'rails', 'init.rb')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
@@ -26,7 +26,7 @@ autorequire:
26
26
  bindir: bin
27
27
  cert_chain: []
28
28
 
29
- date: 2010-02-17 00:00:00 -05:00
29
+ date: 2010-02-21 00:00:00 -05:00
30
30
  default_executable:
31
31
  dependencies: []
32
32
 
@@ -40,7 +40,7 @@ extra_rdoc_files:
40
40
  - LICENSE
41
41
  - README.md
42
42
  files:
43
- - CHANGELOG.textile
43
+ - CHANGELOG.md
44
44
  - LICENSE
45
45
  - README.md
46
46
  - Rakefile
@@ -138,12 +138,13 @@ test_files:
138
138
  - test/rails_root/config/environments/production.rb
139
139
  - test/rails_root/config/environments/test.rb
140
140
  - test/rails_root/config/initializers/clearance.rb
141
+ - test/rails_root/config/initializers/clearance_loader.rb
141
142
  - test/rails_root/config/initializers/inflections.rb
142
143
  - test/rails_root/config/initializers/mime_types.rb
143
144
  - test/rails_root/config/initializers/requires.rb
144
145
  - test/rails_root/config/initializers/time_formats.rb
145
146
  - test/rails_root/config/routes.rb
146
- - test/rails_root/db/migrate/20100217171349_clearance_create_users.rb
147
+ - test/rails_root/db/migrate/20100221200020_clearance_create_users.rb
147
148
  - test/rails_root/features/step_definitions/clearance_steps.rb
148
149
  - test/rails_root/features/step_definitions/factory_girl_steps.rb
149
150
  - test/rails_root/features/step_definitions/web_steps.rb