thoughtbot-clearance 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.textile CHANGED
@@ -1,3 +1,8 @@
1
+ h2. 0.8.1 (08/31/2009)
2
+
3
+ * Removed unnecessary remember_token_expires_at column and the
4
+ remember? and forget_me! user instance methods. (Dan Croak)
5
+
1
6
  h2. 0.8.0 (08/31/2009)
2
7
 
3
8
  * Always remember me. Replaced session-and-remember-me authentication with
data/Rakefile CHANGED
@@ -80,7 +80,7 @@ task :default => ['test:basic', 'test:features',
80
80
 
81
81
  gem_spec = Gem::Specification.new do |gem_spec|
82
82
  gem_spec.name = "clearance"
83
- gem_spec.version = "0.8.0"
83
+ gem_spec.version = "0.8.1"
84
84
  gem_spec.summary = "Rails authentication with email & password."
85
85
  gem_spec.email = "support@thoughtbot.com"
86
86
  gem_spec.homepage = "http://github.com/thoughtbot/clearance"
@@ -28,7 +28,7 @@ class Clearance::SessionsController < ApplicationController
28
28
  end
29
29
 
30
30
  def destroy
31
- sign_out(current_user)
31
+ sign_out
32
32
  flash_success_after_destroy
33
33
  redirect_to(url_after_destroy)
34
34
  end
@@ -6,7 +6,6 @@ class ClearanceCreateUsers < ActiveRecord::Migration
6
6
  t.string :salt, :limit => 128
7
7
  t.string :confirmation_token, :limit => 128
8
8
  t.string :remember_token, :limit => 128
9
- t.datetime :remember_token_expires_at
10
9
  t.boolean :email_confirmed, :default => false, :null => false
11
10
  t.timestamps
12
11
  end
@@ -8,7 +8,6 @@ class ClearanceUpdateUsers < ActiveRecord::Migration
8
8
  [:salt, 't.string :salt, :limit => 128'],
9
9
  [:confirmation_token, 't.string :confirmation_token, :limit => 128'],
10
10
  [:remember_token, 't.string :remember_token, :limit => 128'],
11
- [:remember_token_expires_at, 't.datetime :remember_token_expires_at'],
12
11
  [:email_confirmed, 't.boolean :email_confirmed, :default => false, :null => false']
13
12
  ].delete_if {|c| existing_columns.include?(c.first.to_s)}
14
13
  -%>
@@ -51,21 +51,17 @@ module Clearance
51
51
  user.remember_me!
52
52
  cookies[:remember_token] = {
53
53
  :value => user.remember_token,
54
- :expires => user.remember_token_expires_at
54
+ :expires => 1.year.from_now.utc
55
55
  }
56
56
  end
57
57
  end
58
58
 
59
59
  # Sign user out of cookie.
60
60
  #
61
- # @param [User]
62
- #
63
61
  # @example
64
- # sign_out(@user)
65
- def sign_out(user)
66
- user.forget_me! if user
62
+ # sign_out
63
+ def sign_out
67
64
  cookies.delete(:remember_token)
68
- reset_session
69
65
  end
70
66
 
71
67
  # Store the current location.
@@ -83,8 +79,7 @@ module Clearance
83
79
 
84
80
  def user_from_cookie
85
81
  if token = cookies[:remember_token]
86
- return nil unless user = ::User.find_by_remember_token(token)
87
- return user if user.remember?
82
+ ::User.find_by_remember_token(token)
88
83
  end
89
84
  end
90
85
 
@@ -94,7 +89,9 @@ module Clearance
94
89
  end
95
90
 
96
91
  def store_location
97
- session[:return_to] = request.request_uri if request.get?
92
+ if request.get?
93
+ session[:return_to] = request.request_uri
94
+ end
98
95
  end
99
96
 
100
97
  def redirect_back_or(default)
@@ -101,17 +101,6 @@ module Clearance
101
101
  encrypted_password == encrypt(password)
102
102
  end
103
103
 
104
- # Am I remembered?
105
- #
106
- # @return [true, false]
107
- # @example
108
- # user.remember?
109
- def remember?
110
- remember_token &&
111
- remember_token_expires_at &&
112
- Time.now.utc < remember_token_expires_at
113
- end
114
-
115
104
  # Remember me for a year.
116
105
  #
117
106
  # @example
@@ -121,16 +110,7 @@ module Clearance
121
110
  # :expires => user.remember_token_expires_at
122
111
  # }
123
112
  def remember_me!
124
- remember_me_until! 1.year.from_now.utc
125
- end
126
-
127
- # Forget me.
128
- #
129
- # @example
130
- # user.forget_me!
131
- def forget_me!
132
- self.remember_token = nil
133
- self.remember_token_expires_at = nil
113
+ self.remember_token = encrypt("--#{Time.now.utc}--#{password}--")
134
114
  save(false)
135
115
  end
136
116
 
@@ -200,12 +180,6 @@ module Clearance
200
180
  def password_required?
201
181
  encrypted_password.blank? || !password.blank?
202
182
  end
203
-
204
- def remember_me_until!(time)
205
- self.remember_token_expires_at = time
206
- self.remember_token = encrypt("--#{time}--#{password}--")
207
- save(false)
208
- end
209
183
  end
210
184
 
211
185
  module ClassMethods
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thoughtbot-clearance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
@@ -115,6 +115,8 @@ files:
115
115
  - rails/init.rb
116
116
  has_rdoc: true
117
117
  homepage: http://github.com/thoughtbot/clearance
118
+ licenses: []
119
+
118
120
  post_install_message:
119
121
  rdoc_options: []
120
122
 
@@ -135,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
137
  requirements: []
136
138
 
137
139
  rubyforge_project:
138
- rubygems_version: 1.2.0
140
+ rubygems_version: 1.3.5
139
141
  signing_key:
140
142
  specification_version: 3
141
143
  summary: Rails authentication with email & password.