authlogic 2.1.3 → 2.1.4

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.

@@ -78,7 +78,7 @@ Apparently there is a bug with apache / passenger for v2.1.X with sessions not w
78
78
 
79
79
  == Documentation explanation
80
80
 
81
- You can find anything you want about Authlogic in the {documentation}[http://authlogic.rubyforge.org], all that you need to do is understand the basic design behind it.
81
+ You can find anything you want about Authlogic in the {documentation}[http://rdoc.info/projects/binarylogic/authlogic], all that you need to do is understand the basic design behind it.
82
82
 
83
83
  That being said, there are 2 models involved during authentication. Your Authlogic model and your ActiveRecord model:
84
84
 
@@ -87,7 +87,7 @@ That being said, there are 2 models involved during authentication. Your Authlog
87
87
 
88
88
  Each of the above has its various sub modules that contain common logic. The sub modules are responsible for including *everything* related to it: configuration, class methods, instance methods, etc.
89
89
 
90
- For example, if you want to timeout users after a certain period of inactivity, you would look in <b>Authlogic::Session::Timeout</b>. To help you out, I listed the following publicly relevant modules with short descriptions. For the sake of brevity, there are more modules than listed here, the ones not listed are more for internal use, but you can easily read up on them in the {documentation}[http://authlogic.rubyforge.org].
90
+ For example, if you want to timeout users after a certain period of inactivity, you would look in <b>Authlogic::Session::Timeout</b>. To help you out, I listed the following publicly relevant modules with short descriptions. For the sake of brevity, there are more modules than listed here, the ones not listed are more for internal use, but you can easily read up on them in the {documentation}[http://rdoc.info/projects/binarylogic/authlogic].
91
91
 
92
92
  === Authlogic::ActsAsAuthentic sub modules
93
93
 
data/Rakefile CHANGED
@@ -9,10 +9,9 @@ begin
9
9
  gem.email = "bjohnson@binarylogic.com"
10
10
  gem.homepage = "http://github.com/binarylogic/authlogic"
11
11
  gem.authors = ["Ben Johnson of Binary Logic"]
12
- gem.rubyforge_project = "authlogic"
13
12
  gem.add_dependency "activesupport"
14
13
  end
15
- Jeweler::RubyforgeTasks.new
14
+ Jeweler::GemcutterTasks.new
16
15
  rescue LoadError
17
16
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
17
  end
@@ -1,5 +1,5 @@
1
1
  ---
2
+ :major: 2
2
3
  :minor: 1
3
- :patch: 3
4
+ :patch: 4
4
5
  :build:
5
- :major: 2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{authlogic}
8
- s.version = "2.1.3"
8
+ s.version = "2.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ben Johnson of Binary Logic"]
12
- s.date = %q{2009-11-12}
12
+ s.date = %q{2010-05-23}
13
13
  s.email = %q{bjohnson@binarylogic.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -145,8 +145,7 @@ Gem::Specification.new do |s|
145
145
  s.homepage = %q{http://github.com/binarylogic/authlogic}
146
146
  s.rdoc_options = ["--charset=UTF-8"]
147
147
  s.require_paths = ["lib"]
148
- s.rubyforge_project = %q{authlogic}
149
- s.rubygems_version = %q{1.3.5}
148
+ s.rubygems_version = %q{1.3.7}
150
149
  s.summary = %q{A clean, simple, and unobtrusive ruby authentication solution.}
151
150
  s.test_files = [
152
151
  "test/acts_as_authentic_test/base_test.rb",
@@ -205,7 +204,7 @@ Gem::Specification.new do |s|
205
204
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
206
205
  s.specification_version = 3
207
206
 
208
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
207
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
209
208
  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
210
209
  else
211
210
  s.add_dependency(%q<activesupport>, [">= 0"])
@@ -1,57 +1,64 @@
1
1
  require "active_record"
2
2
 
3
- require File.dirname(__FILE__) + "/authlogic/i18n"
4
- require File.dirname(__FILE__) + "/authlogic/random"
5
- require File.dirname(__FILE__) + "/authlogic/regex"
3
+ AUTHLOGIC_PATH = File.dirname(__FILE__) + "/authlogic/"
6
4
 
7
- require File.dirname(__FILE__) + "/authlogic/controller_adapters/abstract_adapter"
8
- require File.dirname(__FILE__) + "/authlogic/controller_adapters/rails_adapter" if defined?(Rails)
9
- require File.dirname(__FILE__) + "/authlogic/controller_adapters/merb_adapter" if defined?(Merb)
10
- require File.dirname(__FILE__) + "/authlogic/controller_adapters/sinatra_adapter" if defined?(Sinatra)
5
+ [
6
+ "i18n",
7
+ "random",
8
+ "regex",
9
+
10
+ "controller_adapters/abstract_adapter",
11
+
12
+ "crypto_providers/md5",
13
+ "crypto_providers/sha1",
14
+ "crypto_providers/sha256",
15
+ "crypto_providers/sha512",
16
+ "crypto_providers/bcrypt",
17
+ "crypto_providers/aes256",
18
+
19
+ "authenticates_many/base",
20
+ "authenticates_many/association",
21
+
22
+ "acts_as_authentic/email",
23
+ "acts_as_authentic/logged_in_status",
24
+ "acts_as_authentic/login",
25
+ "acts_as_authentic/magic_columns",
26
+ "acts_as_authentic/password",
27
+ "acts_as_authentic/perishable_token",
28
+ "acts_as_authentic/persistence_token",
29
+ "acts_as_authentic/restful_authentication",
30
+ "acts_as_authentic/session_maintenance",
31
+ "acts_as_authentic/single_access_token",
32
+ "acts_as_authentic/validations_scope",
33
+ "acts_as_authentic/base",
34
+
35
+ "session/activation",
36
+ "session/active_record_trickery",
37
+ "session/brute_force_protection",
38
+ "session/callbacks",
39
+ "session/cookies",
40
+ "session/existence",
41
+ "session/foundation",
42
+ "session/http_auth",
43
+ "session/id",
44
+ "session/klass",
45
+ "session/magic_columns",
46
+ "session/magic_states",
47
+ "session/params",
48
+ "session/password",
49
+ "session/perishable_token",
50
+ "session/persistence",
51
+ "session/priority_record",
52
+ "session/scopes",
53
+ "session/session",
54
+ "session/timeout",
55
+ "session/unauthorized_record",
56
+ "session/validation",
57
+ "session/base"
58
+ ].each do |library|
59
+ require AUTHLOGIC_PATH + library
60
+ end
11
61
 
12
- require File.dirname(__FILE__) + "/authlogic/crypto_providers/md5"
13
- require File.dirname(__FILE__) + "/authlogic/crypto_providers/sha1"
14
- require File.dirname(__FILE__) + "/authlogic/crypto_providers/sha256"
15
- require File.dirname(__FILE__) + "/authlogic/crypto_providers/sha512"
16
- require File.dirname(__FILE__) + "/authlogic/crypto_providers/bcrypt"
17
- require File.dirname(__FILE__) + "/authlogic/crypto_providers/aes256"
18
-
19
- require File.dirname(__FILE__) + "/authlogic/authenticates_many/base"
20
- require File.dirname(__FILE__) + "/authlogic/authenticates_many/association"
21
-
22
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/email"
23
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/logged_in_status"
24
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/login"
25
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/magic_columns"
26
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/password"
27
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/perishable_token"
28
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/persistence_token"
29
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/restful_authentication"
30
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/session_maintenance"
31
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/single_access_token"
32
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/validations_scope"
33
- require File.dirname(__FILE__) + "/authlogic/acts_as_authentic/base"
34
-
35
- require File.dirname(__FILE__) + "/authlogic/session/activation"
36
- require File.dirname(__FILE__) + "/authlogic/session/active_record_trickery"
37
- require File.dirname(__FILE__) + "/authlogic/session/brute_force_protection"
38
- require File.dirname(__FILE__) + "/authlogic/session/callbacks"
39
- require File.dirname(__FILE__) + "/authlogic/session/cookies"
40
- require File.dirname(__FILE__) + "/authlogic/session/existence"
41
- require File.dirname(__FILE__) + "/authlogic/session/foundation"
42
- require File.dirname(__FILE__) + "/authlogic/session/http_auth"
43
- require File.dirname(__FILE__) + "/authlogic/session/id"
44
- require File.dirname(__FILE__) + "/authlogic/session/klass"
45
- require File.dirname(__FILE__) + "/authlogic/session/magic_columns"
46
- require File.dirname(__FILE__) + "/authlogic/session/magic_states"
47
- require File.dirname(__FILE__) + "/authlogic/session/params"
48
- require File.dirname(__FILE__) + "/authlogic/session/password"
49
- require File.dirname(__FILE__) + "/authlogic/session/perishable_token"
50
- require File.dirname(__FILE__) + "/authlogic/session/persistence"
51
- require File.dirname(__FILE__) + "/authlogic/session/priority_record"
52
- require File.dirname(__FILE__) + "/authlogic/session/scopes"
53
- require File.dirname(__FILE__) + "/authlogic/session/session"
54
- require File.dirname(__FILE__) + "/authlogic/session/timeout"
55
- require File.dirname(__FILE__) + "/authlogic/session/unauthorized_record"
56
- require File.dirname(__FILE__) + "/authlogic/session/validation"
57
- require File.dirname(__FILE__) + "/authlogic/session/base"
62
+ require AUTHLOGIC_PATH + "controller_adapters/rails_adapter" if defined?( Rails )
63
+ require AUTHLOGIC_PATH + "controller_adapters/merb_adapter" if defined?( Merb )
64
+ require AUTHLOGIC_PATH + "controller_adapters/sinatra_adapter" if defined?( Sinatra )
@@ -64,8 +64,8 @@ module Authlogic
64
64
  # u.password = "new pass"
65
65
  # u.valid_password?("old pass")
66
66
  #
67
- # Should the last line above return true or false? The record hasn't been saved yet, so most would assume yes.
68
- # Other would assume no. So I let you decide by giving you this option.
67
+ # Should the last line above return true or false? The record hasn't been saved yet, so most would assume true.
68
+ # Other would assume false. So I let you decide by giving you this option.
69
69
  #
70
70
  # * <tt>Default:</tt> true
71
71
  # * <tt>Accepts:</tt> Boolean
@@ -180,6 +180,17 @@ module Authlogic
180
180
  def self.included(klass)
181
181
  return if klass.crypted_password_field.nil?
182
182
  klass.define_callbacks *METHODS
183
+
184
+ # If Rails 3, support the new callback syntax
185
+ if klass.singleton_class.method_defined?(:set_callback)
186
+ METHODS.each do |method|
187
+ klass.class_eval <<-"end_eval", __FILE__, __LINE__
188
+ def self.#{method}(*methods, &block)
189
+ set_callback :#{method}, *methods, &block
190
+ end
191
+ end_eval
192
+ end
193
+ end
183
194
  end
184
195
 
185
196
  private
@@ -15,7 +15,7 @@ module Authlogic
15
15
 
16
16
  def cookie_domain
17
17
  @cookie_domain_key ||= Rails::VERSION::STRING >= '2.3' ? :domain : :session_domain
18
- ActionController::Base.session_options[@cookie_domain_key]
18
+ controller.request.session_options[@cookie_domain_key]
19
19
  end
20
20
 
21
21
  def request_content_type
@@ -40,8 +40,11 @@ module Authlogic
40
40
 
41
41
  # For rails >= 3.0
42
42
  def model_name
43
- clazz = defined?(::ActiveModel) ? ::ActiveModel::Name : ::ActiveSupport::ModelName
44
- clazz.new(self.to_s)
43
+ if defined?(::ActiveModel)
44
+ ::ActiveModel::Name.new(self)
45
+ else
46
+ ::ActiveSupport::ModelName.new(self.to_s)
47
+ end
45
48
  end
46
49
  end
47
50
 
@@ -64,6 +64,17 @@ module Authlogic
64
64
  def self.included(base) #:nodoc:
65
65
  base.send :include, ActiveSupport::Callbacks
66
66
  base.define_callbacks *METHODS
67
+
68
+ # If Rails 3, support the new callback syntax
69
+ if base.singleton_class.method_defined?(:set_callback)
70
+ METHODS.each do |method|
71
+ base.class_eval <<-"end_eval", __FILE__, __LINE__
72
+ def self.#{method}(*methods, &block)
73
+ set_callback :#{method}, *methods, &block
74
+ end
75
+ end_eval
76
+ end
77
+ end
67
78
  end
68
79
 
69
80
  private
@@ -39,7 +39,7 @@ module Authlogic
39
39
  #
40
40
  # or you can pass an array of objects:
41
41
  #
42
- # session.credentails = [my_user_object, true]
42
+ # session.credentials = [my_user_object, true]
43
43
  #
44
44
  # and if you need to set an id, just pass it last. This value need be the last item in the array you pass, since the id is something that
45
45
  # you control yourself, it should never be set from a hash or a form. Examples:
@@ -74,6 +74,10 @@ module ActsAsAuthenticTest
74
74
  u.valid?
75
75
  assert u.errors[:email].size == 0
76
76
 
77
+ u.email = "damien+test1...etc..@mydomain.com"
78
+ u.valid?
79
+ assert u.errors[:email].size == 0
80
+
77
81
  u.email = "dakota.dux+1@gmail.com"
78
82
  u.valid?
79
83
  assert u.errors[:email].size == 0
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ hash: 3
5
+ prerelease: false
6
+ segments:
7
+ - 2
8
+ - 1
9
+ - 4
10
+ version: 2.1.4
5
11
  platform: ruby
6
12
  authors:
7
13
  - Ben Johnson of Binary Logic
@@ -9,19 +15,23 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-11-12 00:00:00 -05:00
18
+ date: 2010-05-23 00:00:00 -04:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: activesupport
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
- version:
33
+ type: :runtime
34
+ version_requirements: *id001
25
35
  description:
26
36
  email: bjohnson@binarylogic.com
27
37
  executables: []
@@ -167,21 +177,27 @@ rdoc_options:
167
177
  require_paths:
168
178
  - lib
169
179
  required_ruby_version: !ruby/object:Gem::Requirement
180
+ none: false
170
181
  requirements:
171
182
  - - ">="
172
183
  - !ruby/object:Gem::Version
184
+ hash: 3
185
+ segments:
186
+ - 0
173
187
  version: "0"
174
- version:
175
188
  required_rubygems_version: !ruby/object:Gem::Requirement
189
+ none: false
176
190
  requirements:
177
191
  - - ">="
178
192
  - !ruby/object:Gem::Version
193
+ hash: 3
194
+ segments:
195
+ - 0
179
196
  version: "0"
180
- version:
181
197
  requirements: []
182
198
 
183
- rubyforge_project: authlogic
184
- rubygems_version: 1.3.5
199
+ rubyforge_project:
200
+ rubygems_version: 1.3.7
185
201
  signing_key:
186
202
  specification_version: 3
187
203
  summary: A clean, simple, and unobtrusive ruby authentication solution.