authlogic 1.2.0 → 1.2.1

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

Potentially problematic release.


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

Files changed (34) hide show
  1. data/CHANGELOG.rdoc +7 -0
  2. data/Manifest +4 -4
  3. data/README.rdoc +49 -20
  4. data/Rakefile +0 -1
  5. data/authlogic.gemspec +9 -7
  6. data/lib/authlogic.rb +3 -3
  7. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/config.rb +35 -17
  8. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/credentials.rb +21 -17
  9. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/perishability.rb +75 -0
  10. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/persistence.rb +7 -7
  11. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/session_maintenance.rb +1 -1
  12. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/single_access.rb +2 -2
  13. data/lib/authlogic/session/authenticates_many_association.rb +1 -0
  14. data/lib/authlogic/session/config.rb +4 -4
  15. data/lib/authlogic/session/cookies.rb +2 -2
  16. data/lib/authlogic/session/params.rb +2 -2
  17. data/lib/authlogic/session/perishability.rb +18 -0
  18. data/lib/authlogic/session/session.rb +2 -2
  19. data/lib/authlogic/version.rb +1 -1
  20. data/test/fixtures/employees.yml +2 -2
  21. data/test/fixtures/users.yml +3 -3
  22. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/config_test.rb +8 -4
  23. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/credentials_test.rb +5 -5
  24. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/perishability_test.rb +41 -0
  25. data/test/session_tests/authenticates_many_association_test.rb +8 -0
  26. data/test/session_tests/base_test.rb +4 -4
  27. data/test/session_tests/cookies_test.rb +1 -1
  28. data/test/session_tests/{password_reset_test.rb → perishability_test.rb} +3 -3
  29. data/test/session_tests/session_test.rb +4 -4
  30. data/test/test_helper.rb +5 -5
  31. metadata +11 -11
  32. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/password_reset.rb +0 -73
  33. data/lib/authlogic/session/password_reset.rb +0 -17
  34. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/password_reset_test.rb +0 -40
@@ -8,21 +8,21 @@ module Authlogic
8
8
  #
9
9
  # === Class Methods
10
10
  #
11
- # * <tt>forget_all!</tt> - resets ALL records remember_token to a unique value, requiring all users to re-login
11
+ # * <tt>forget_all!</tt> - resets ALL records persistence_token to a unique value, requiring all users to re-login
12
12
  # * <tt>unique_token</tt> - returns a pretty hardcore random token that is finally encrypted with a hash algorithm
13
13
  #
14
14
  # === Instance Methods
15
15
  #
16
- # * <tt>forget!</tt> - resets the record's remember_token which requires them to re-login
16
+ # * <tt>forget!</tt> - resets the record's persistence_token which requires them to re-login
17
17
  #
18
18
  # === Alias Method Chains
19
19
  #
20
- # * <tt>#{options[:password_field]}</tt> - adds in functionality to reset the remember token when the password is changed
20
+ # * <tt>#{options[:password_field]}</tt> - adds in functionality to reset the persistence token when the password is changed
21
21
  module Persistence
22
22
  def acts_as_authentic_with_persistence(options = {})
23
23
  acts_as_authentic_without_persistence(options)
24
24
 
25
- validates_uniqueness_of options[:remember_token_field]
25
+ validates_uniqueness_of options[:persistence_token_field]
26
26
 
27
27
  def forget_all!
28
28
  # Paginate these to save on memory
@@ -37,19 +37,19 @@ module Authlogic
37
37
 
38
38
  class_eval <<-"end_eval", __FILE__, __LINE__
39
39
  def self.unique_token
40
- # The remember token should be a unique string that is not reversible, which is what a hash is all about
40
+ # The persistence token should be a unique string that is not reversible, which is what a hash is all about
41
41
  # if you using encryption this defaults to Sha512.
42
42
  token_class = #{options[:crypto_provider].respond_to?(:decrypt) ? Authlogic::CryptoProviders::Sha512 : options[:crypto_provider]}
43
43
  token_class.encrypt(Time.now.to_s + (1..10).collect{ rand.to_s }.join)
44
44
  end
45
45
 
46
46
  def forget!
47
- self.#{options[:remember_token_field]} = self.class.unique_token
47
+ self.#{options[:persistence_token_field]} = self.class.unique_token
48
48
  save_without_session_maintenance(false)
49
49
  end
50
50
 
51
51
  def #{options[:password_field]}_with_persistence=(value)
52
- self.#{options[:remember_token_field]} = self.class.unique_token
52
+ self.#{options[:persistence_token_field]} = self.class.unique_token
53
53
  self.#{options[:password_field]}_without_persistence = value
54
54
  end
55
55
  alias_method_chain :#{options[:password_field]}=, :persistence
@@ -30,7 +30,7 @@ module Authlogic
30
30
 
31
31
  protected
32
32
  def update_sessions?
33
- !@skip_session_maintenance && #{options[:session_class]}.activated? && !#{options[:session_ids].inspect}.blank? && #{options[:remember_token_field]}_changed?
33
+ !@skip_session_maintenance && #{options[:session_class]}.activated? && !#{options[:session_ids].inspect}.blank? && #{options[:persistence_token_field]}_changed?
34
34
  end
35
35
 
36
36
  def get_session_information
@@ -4,8 +4,8 @@ module Authlogic
4
4
  module ActsAsAuthentic
5
5
  # = Single Access
6
6
  #
7
- # Instead of repeating myself here, checkout the README. There is a "Single Access" section in there that goes over this. Keep in mind none of this will be applied if there
8
- # is not a single_access_token field supplied in the database.
7
+ # Instead of repeating myself here, checkout the README. There is a "Tokens" section in there that goes over the single access token.
8
+ # Keep in mind none of this will be applied if there is not a single_access_token field supplied in the database.
9
9
  #
10
10
  # === Instance Methods
11
11
  #
@@ -27,6 +27,7 @@ module Authlogic
27
27
  end
28
28
  end_eval
29
29
  end
30
+ alias_method :build, :new
30
31
 
31
32
  private
32
33
  def scope_options
@@ -389,8 +389,8 @@ module Authlogic
389
389
  self.class.password_invalid_message
390
390
  end
391
391
 
392
- def password_reset_token_field
393
- klass.acts_as_authentic_config[:password_reset_token_field]
392
+ def perishable_token_field
393
+ klass.acts_as_authentic_config[:perishable_token_field]
394
394
  end
395
395
 
396
396
  def remember_me_for
@@ -398,8 +398,8 @@ module Authlogic
398
398
  self.class.remember_me_for
399
399
  end
400
400
 
401
- def remember_token_field
402
- klass.acts_as_authentic_config[:remember_token_field]
401
+ def persistence_token_field
402
+ klass.acts_as_authentic_config[:persistence_token_field]
403
403
  end
404
404
 
405
405
  def session_key
@@ -12,7 +12,7 @@ module Authlogic
12
12
  # Tries to validate the session from information in the cookie
13
13
  def valid_cookie?
14
14
  if cookie_credentials
15
- self.unauthorized_record = search_for_record("find_by_#{remember_token_field}", cookie_credentials)
15
+ self.unauthorized_record = search_for_record("find_by_#{persistence_token_field}", cookie_credentials)
16
16
  return valid?
17
17
  end
18
18
 
@@ -26,7 +26,7 @@ module Authlogic
26
26
 
27
27
  def save_cookie
28
28
  controller.cookies[cookie_key] = {
29
- :value => record.send(remember_token_field),
29
+ :value => record.send(persistence_token_field),
30
30
  :expires => remember_me_until
31
31
  }
32
32
  end
@@ -7,8 +7,8 @@ module Authlogic
7
7
  #
8
8
  # https://www.domain.com?user_credentials=[insert single access token here]
9
9
  #
10
- # Wait, what is a single access token? It is all explained in the README. Checkout the "Single Access" section in the README. For security reasons, this type of authentication
11
- # is ONLY available via single access tokens, you can NOT pass your remember token.
10
+ # Wait, what is a single access token? It is all explained in the README. Checkout the "Tokens" section in the README, there is section about
11
+ # single access tokens. For security reasons, this type of authentication is ONLY available via single access tokens, you can NOT pass your persistence token.
12
12
  module Params
13
13
  # Tries to validate the session from information in the params token
14
14
  def valid_params?
@@ -0,0 +1,18 @@
1
+ module Authlogic
2
+ module Session
3
+ # = Perishability
4
+ #
5
+ # Maintains the perishable token, which is helpful for confirming records or authorizing records to reset their password. All that this
6
+ # module does is reset it after a session have been saved, just keep it changing. The more it changes, the tighter the security.
7
+ module Perishability
8
+ def self.included(klass)
9
+ klass.after_save :reset_perishable_token!
10
+ end
11
+
12
+ private
13
+ def reset_perishable_token!
14
+ record.send("reset_#{perishable_token_field}!") if record.respond_to?("reset_#{perishable_token_field}!")
15
+ end
16
+ end
17
+ end
18
+ end
@@ -13,7 +13,7 @@ module Authlogic
13
13
  # Tries to validate the session from information in the session
14
14
  def valid_session?
15
15
  if session_credentials
16
- self.unauthorized_record = search_for_record("find_by_#{remember_token_field}", session_credentials)
16
+ self.unauthorized_record = search_for_record("find_by_#{persistence_token_field}", session_credentials)
17
17
  return valid?
18
18
  end
19
19
 
@@ -26,7 +26,7 @@ module Authlogic
26
26
  end
27
27
 
28
28
  def update_session!
29
- controller.session[session_key] = record && record.send(remember_token_field)
29
+ controller.session[session_key] = record && record.send(persistence_token_field)
30
30
  end
31
31
  end
32
32
  end
@@ -44,7 +44,7 @@ module Authlogic # :nodoc:
44
44
 
45
45
  MAJOR = 1
46
46
  MINOR = 2
47
- TINY = 0
47
+ TINY = 1
48
48
 
49
49
  # The current version as a Version instance
50
50
  CURRENT = new(MAJOR, MINOR, TINY)
@@ -3,7 +3,7 @@ drew:
3
3
  email: dgainor@binarylogic.com
4
4
  password_salt: <%= salt = Employee.unique_token %>
5
5
  crypted_password: "<%= Employee.acts_as_authentic_config[:crypto_provider].encrypt("drewrocks" + salt) %>"
6
- remember_token: 5273d85ed156e9dbd6a7c1438d319ef8c8d41dd24368db6c222de11346c7b11e53ee08d45ecf619b1c1dc91233d22b372482b751b066d0a6f6f9bac42eacaabf
6
+ persistence_token: 5273d85ed156e9dbd6a7c1438d319ef8c8d41dd24368db6c222de11346c7b11e53ee08d45ecf619b1c1dc91233d22b372482b751b066d0a6f6f9bac42eacaabf
7
7
  first_name: Drew
8
8
  last_name: Gainor
9
9
 
@@ -12,6 +12,6 @@ jennifer:
12
12
  email: jjohnson@logicoverdata.com
13
13
  password_salt: <%= salt = Employee.unique_token %>
14
14
  crypted_password: "<%= Employee.acts_as_authentic_config[:crypto_provider].encrypt("jenniferocks" + salt) %>"
15
- remember_token: 2be52a8f741ad00056e6f94eb6844d5316527206da7a3a5e3d0e14d19499ef9fe4c47c89b87febb59a2b41a69edfb4733b6b79302040f3de83f297c6991c75a2
15
+ persistence_token: 2be52a8f741ad00056e6f94eb6844d5316527206da7a3a5e3d0e14d19499ef9fe4c47c89b87febb59a2b41a69edfb4733b6b79302040f3de83f297c6991c75a2
16
16
  first_name: Jennifer
17
17
  last_name: Johnson
@@ -4,9 +4,9 @@ ben:
4
4
  login: bjohnson
5
5
  password_salt: <%= salt = User.unique_token %>
6
6
  crypted_password: <%= Authlogic::CryptoProviders::Sha512.encrypt("benrocks" + salt) %>
7
- remember_token: 6cde0674657a8a313ce952df979de2830309aa4c11ca65805dd00bfdc65dbcc2f5e36718660a1d2e68c1a08c276d996763985d2f06fd3d076eb7bc4d97b1e317
7
+ persistence_token: 6cde0674657a8a313ce952df979de2830309aa4c11ca65805dd00bfdc65dbcc2f5e36718660a1d2e68c1a08c276d996763985d2f06fd3d076eb7bc4d97b1e317
8
8
  single_access_token: <%= User.friendly_unique_token %>
9
- password_reset_token: <%= User.friendly_unique_token %>
9
+ perishable_token: <%= User.friendly_unique_token %>
10
10
  email: bjohnson@binarylogic.com
11
11
  first_name: Ben
12
12
  last_name: Johnson
@@ -17,7 +17,7 @@ zack:
17
17
  login: zham
18
18
  password_salt: <%= salt = User.unique_token %>
19
19
  crypted_password: <%= Authlogic::CryptoProviders::Sha512.encrypt("zackrocks" + salt) %>
20
- remember_token: fd3c2d5ce09ab98e7547d21f1b3dcf9158a9a19b5d3022c0402f32ae197019fce3fdbc6614d7ee57d719bae53bb089e30edc9e5d6153e5bc3afca0ac1d320342
20
+ persistence_token: fd3c2d5ce09ab98e7547d21f1b3dcf9158a9a19b5d3022c0402f32ae197019fce3fdbc6614d7ee57d719bae53bb089e30edc9e5d6153e5bc3afca0ac1d320342
21
21
  single_access_token: <%= User.friendly_unique_token %>
22
22
  email: zham@ziggityzack.com
23
23
  first_name: Zack
@@ -17,12 +17,12 @@ module ORMAdaptersTests
17
17
  :login_field_regex => /\A\w[\w\.\-_@ ]+\z/,
18
18
  :session_ids => [nil],
19
19
  :login_field_regex_failed_message => "use only letters, numbers, spaces, and .-_@ please.",
20
- :remember_token_field => :remember_token,
20
+ :persistence_token_field => :persistence_token,
21
21
  :password_field => :password,
22
22
  :logged_in_timeout => 600,
23
23
  :password_salt_field => :password_salt,
24
- :password_reset_token_valid_for => 600,
25
- :password_reset_token_field => :password_reset_token,
24
+ :perishable_token_valid_for => 600,
25
+ :perishable_token_field => :perishable_token,
26
26
  :login_field_type => :login,
27
27
  :crypto_provider => Authlogic::CryptoProviders::Sha512,
28
28
  :password_blank_message => "can not be blank",
@@ -31,7 +31,11 @@ module ORMAdaptersTests
31
31
  :login_field => :login,
32
32
  :email_field => :email,
33
33
  :email_field_regex => /\A[\w\.%\+\-]+@(?:[A-Z0-9\-]+\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)\z/i,
34
- :email_field_regex_failed_message=>"should look like an email address."
34
+ :email_field_regex_failed_message=>"should look like an email address.",
35
+ :validate_fields => true,
36
+ :validate_login_field => true,
37
+ :validate_email_field => true,
38
+ :validate_password_field => true
35
39
  }
36
40
  assert_equal default_config, User.acts_as_authentic_config
37
41
  end
@@ -94,14 +94,14 @@ module ORMAdaptersTests
94
94
  user.password = "sillywilly"
95
95
  assert user.crypted_password
96
96
  assert user.password_salt
97
- assert user.remember_token
97
+ assert user.persistence_token
98
98
  assert_equal true, user.tried_to_set_password
99
99
  assert_nil user.password
100
100
 
101
101
  employee = Employee.new
102
102
  employee.password = "awesome"
103
103
  assert employee.crypted_password
104
- assert employee.remember_token
104
+ assert employee.persistence_token
105
105
  assert_equal true, employee.tried_to_set_password
106
106
  assert_nil employee.password
107
107
  end
@@ -123,18 +123,18 @@ module ORMAdaptersTests
123
123
 
124
124
  old_password = ben.crypted_password
125
125
  old_salt = ben.password_salt
126
- old_remember_token = ben.remember_token
126
+ old_persistence_token = ben.persistence_token
127
127
  ben.reset_password
128
128
  assert_not_equal old_password, ben.crypted_password
129
129
  assert_not_equal old_salt, ben.password_salt
130
- assert_not_equal old_remember_token, ben.remember_token
130
+ assert_not_equal old_persistence_token, ben.persistence_token
131
131
  assert UserSession.find
132
132
 
133
133
  ben.reset_password!
134
134
  ben.reload
135
135
  assert_not_equal old_password, ben.crypted_password
136
136
  assert_not_equal old_salt, ben.password_salt
137
- assert_not_equal old_remember_token, ben.remember_token
137
+ assert_not_equal old_persistence_token, ben.persistence_token
138
138
  assert !UserSession.find
139
139
  end
140
140
  end
@@ -0,0 +1,41 @@
1
+ require File.dirname(__FILE__) + '/../../../test_helper.rb'
2
+
3
+ module ORMAdaptersTests
4
+ module ActiveRecordAdapterTests
5
+ module ActsAsAuthenticTests
6
+ class PerishabilityTest < ActiveSupport::TestCase
7
+ def test_before_validation
8
+ ben = users(:ben)
9
+ old_perishable_token = ben.perishable_token
10
+ assert ben.valid?
11
+ assert_not_equal old_perishable_token, ben.perishable_token
12
+ ben.reload
13
+ assert_equal old_perishable_token, ben.perishable_token
14
+ assert ben.save
15
+ assert_not_equal old_perishable_token, ben.perishable_token
16
+ end
17
+
18
+ def test_find_using_perishable_token
19
+ ben = users(:ben)
20
+ assert_nil User.find_using_perishable_token("")
21
+ assert_equal ben, User.find_using_perishable_token(ben.perishable_token)
22
+ assert ben.class.connection.execute("update users set updated_at = '#{10.minutes.ago.to_s(:db)}' where id = '#{ben.id}';")
23
+ assert_nil User.find_using_perishable_token(ben.perishable_token)
24
+ assert_equal ben, User.find_using_perishable_token(ben.perishable_token, 20.minutes)
25
+ end
26
+
27
+ def test_reset_perishable_token
28
+ ben = users(:ben)
29
+ old_perishable_token = ben.perishable_token
30
+ ben.reset_perishable_token
31
+ assert_not_equal old_perishable_token, ben.perishable_token
32
+ ben.reload
33
+ assert_equal old_perishable_token, ben.perishable_token
34
+ ben.reset_perishable_token!
35
+ ben.reload
36
+ assert_not_equal old_perishable_token, ben.perishable_token
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -16,5 +16,13 @@ module SessionTests
16
16
  assert_equal ben, session.unauthorized_record
17
17
  assert_equal({:find_options => {:conditions => ["1 = ?", 1]}, :id => :some_id}, session.scope)
18
18
  end
19
+
20
+ def test_build
21
+ binary_logic = companies(:binary_logic)
22
+ ben = users(:ben)
23
+ session = binary_logic.user_sessions.build(ben)
24
+ assert_equal ben, session.unauthorized_record
25
+ assert_equal({:find_options => {:conditions => "\"users\".company_id = #{binary_logic.id}"}, :id => nil}, session.scope)
26
+ end
19
27
  end
20
28
  end
@@ -55,10 +55,10 @@ module SessionTests
55
55
 
56
56
  assert UserSession.find
57
57
  last_request_at = ben.reload.last_request_at
58
- sleep(1)
58
+ sleep(1.1)
59
59
  assert UserSession.find
60
60
  assert_equal last_request_at, ben.reload.last_request_at
61
- sleep(1)
61
+ sleep(1.1)
62
62
  assert UserSession.find
63
63
  assert_not_equal last_request_at, ben.reload.last_request_at
64
64
 
@@ -157,10 +157,10 @@ module SessionTests
157
157
 
158
158
  def test_inspect
159
159
  session = UserSession.new
160
- assert_equal "#<UserSession {:login=>nil, :password=>\"<protected>\"}>", session.inspect
160
+ assert_equal "#<UserSession #{{:login=>nil, :password=>"<protected>"}.inspect}>", session.inspect
161
161
  session.login = "login"
162
162
  session.password = "pass"
163
- assert "#<UserSession {:login=>\"login\", :password=>\"<protected>\"}>" == session.inspect || "#<UserSession {:password=>\"<protected>\", :login=>\"login\"}>" == session.inspect
163
+ assert "#<UserSession #{{:login=>"login", :password=>"<protected>"}.inspect}>" == session.inspect
164
164
  end
165
165
 
166
166
  def test_new_session
@@ -17,7 +17,7 @@ module SessionTests
17
17
  ben = users(:ben)
18
18
  session = UserSession.new(ben)
19
19
  assert session.save
20
- assert_equal ben.remember_token, @controller.cookies["user_credentials"]
20
+ assert_equal ben.persistence_token, @controller.cookies["user_credentials"]
21
21
  end
22
22
 
23
23
  def test_destroy
@@ -1,12 +1,12 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper.rb'
2
2
 
3
3
  module SessionTests
4
- class PasswordResetTest < ActiveSupport::TestCase
4
+ class PerishabilityTest < ActiveSupport::TestCase
5
5
  def test_after_save
6
6
  ben = users(:ben)
7
- old_password_reset_token = ben.password_reset_token
7
+ old_perishable_token = ben.perishable_token
8
8
  session = UserSession.create(ben)
9
- assert_not_equal old_password_reset_token, ben.password_reset_token
9
+ assert_not_equal old_perishable_token, ben.perishable_token
10
10
 
11
11
  drew = employees(:drew)
12
12
  assert UserSession.create(drew)
@@ -12,7 +12,7 @@ module SessionTests
12
12
  assert session.valid_session?
13
13
  assert session.find_record
14
14
  assert_equal ben, session.record
15
- assert_equal ben.remember_token, @controller.session["user_credentials"]
15
+ assert_equal ben.persistence_token, @controller.session["user_credentials"]
16
16
  assert_equal ben, session.unauthorized_record
17
17
  assert !session.new_session?
18
18
  end
@@ -22,13 +22,13 @@ module SessionTests
22
22
  session = UserSession.new(ben)
23
23
  assert @controller.session["user_credentials"].blank?
24
24
  assert session.save
25
- assert_equal ben.remember_token, @controller.session["user_credentials"]
25
+ assert_equal ben.persistence_token, @controller.session["user_credentials"]
26
26
  end
27
27
 
28
28
  def test_destroy
29
29
  ben = users(:ben)
30
30
  set_session_for(ben)
31
- assert_equal ben.remember_token, @controller.session["user_credentials"]
31
+ assert_equal ben.persistence_token, @controller.session["user_credentials"]
32
32
  session = UserSession.find
33
33
  assert session.destroy
34
34
  assert @controller.session["user_credentials"].blank?
@@ -39,7 +39,7 @@ module SessionTests
39
39
  set_cookie_for(ben)
40
40
  assert @controller.session["user_credentials"].blank?
41
41
  assert UserSession.find
42
- assert_equal ben.remember_token, @controller.session["user_credentials"]
42
+ assert_equal ben.persistence_token, @controller.session["user_credentials"]
43
43
  end
44
44
  end
45
45
  end
@@ -38,9 +38,9 @@ ActiveRecord::Schema.define(:version => 1) do
38
38
  t.string :login
39
39
  t.string :crypted_password
40
40
  t.string :password_salt
41
- t.string :remember_token
41
+ t.string :persistence_token
42
42
  t.string :single_access_token
43
- t.string :password_reset_token
43
+ t.string :perishable_token
44
44
  t.string :email
45
45
  t.string :first_name
46
46
  t.string :last_name
@@ -59,7 +59,7 @@ ActiveRecord::Schema.define(:version => 1) do
59
59
  t.string :email
60
60
  t.string :crypted_password
61
61
  t.string :password_salt
62
- t.string :remember_token
62
+ t.string :persistence_token
63
63
  t.string :first_name
64
64
  t.string :last_name
65
65
  t.integer :login_count
@@ -132,7 +132,7 @@ class Test::Unit::TestCase
132
132
  end
133
133
 
134
134
  def set_cookie_for(user, id = nil)
135
- @controller.cookies["user_credentials"] = {:value => user.remember_token, :expires => nil}
135
+ @controller.cookies["user_credentials"] = {:value => user.persistence_token, :expires => nil}
136
136
  end
137
137
 
138
138
  def unset_cookie
@@ -156,7 +156,7 @@ class Test::Unit::TestCase
156
156
  end
157
157
 
158
158
  def set_session_for(user, id = nil)
159
- @controller.session["user_credentials"] = user.remember_token
159
+ @controller.session["user_credentials"] = user.persistence_token
160
160
  end
161
161
 
162
162
  def unset_session