authlogic 5.0.1 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7ee80bf9b23608f9c88971bd8353f1cd1680f25a9d1bc34543a60adc8a6ff0e
4
- data.tar.gz: 836f688d32e87f503357c530a0a380c3e7ea85c566fcca2d08f1990ee9ed3461
3
+ metadata.gz: 6a7be80a92ba37ae9c3456108c6cb5644b8dc0269dcc2c8224430258d82d2b4f
4
+ data.tar.gz: 7973eb69191803b240996d0e0f9c936546f4c4deb1f4f782641f12e5e2bb1816
5
5
  SHA512:
6
- metadata.gz: 14ec354abdd25ef960983f64e4d3fc58b764a365f3c419ffc03bc32d43d2824be585e3557162ff4afd70a0eb94cd86b6a08186302f8478f8369fc2dfded46cee
7
- data.tar.gz: f1bdaba676fdef7a280e3f7063d92551464f4e3eed5c6299ba4f34c9245d39f831c765d43ecfcca4420e31d2acb4079af3abbd180f2babf23281578ff4e4f2b4
6
+ metadata.gz: ddba9c4994b2369496242cb1c4bf6a1ed89546ad277e37c99931051508425e37554df4dc02437e412357adf1a0193fb1d4874992ab859cf3ed9ac0c5d28d28cd
7
+ data.tar.gz: 9548976ebf561b67e0732899489e52e30a7770221f8ad2c80e8e4f415ac318d057c84b508f6607fb145e4a44d22e58a61f36ba469be7f9942c1c3c00b6f05de5
@@ -58,7 +58,8 @@ module Authlogic
58
58
  extend ClassMethods
59
59
  include InstanceMethods
60
60
 
61
- validates_uniqueness_of :perishable_token, if: :will_save_change_to_perishable_token?
61
+ validates_uniqueness_of :perishable_token, case_sensitive: true,
62
+ if: :will_save_change_to_perishable_token?
62
63
  before_save :reset_perishable_token, unless: :disable_perishable_token_maintenance?
63
64
  end
64
65
  end
@@ -27,7 +27,8 @@ module Authlogic
27
27
  end
28
28
 
29
29
  validates_presence_of :persistence_token
30
- validates_uniqueness_of :persistence_token, if: :will_save_change_to_persistence_token?
30
+ validates_uniqueness_of :persistence_token, case_sensitive: true,
31
+ if: :will_save_change_to_persistence_token?
31
32
 
32
33
  before_validation :reset_persistence_token, if: :reset_persistence_token?
33
34
  end
@@ -4,6 +4,19 @@ module Authlogic
4
4
  module ActsAsAuthentic
5
5
  module Queries
6
6
  # The query used by public-API method `find_by_smart_case_login_field`.
7
+ #
8
+ # We use the rails methods `case_insensitive_comparison` and
9
+ # `case_sensitive_comparison`. These methods nicely take into account
10
+ # MySQL collations. (Consider the case where a user *says* they want a
11
+ # case-sensitive uniqueness validation, but then they configure their
12
+ # database to have an insensitive collation. Rails will handle this for
13
+ # us, by downcasing, see
14
+ # `active_record/connection_adapters/abstract_mysql_adapter.rb`) So that's
15
+ # great! But, these methods are not part of rails' public API, so there
16
+ # are no docs. So, everything we know about how to use the methods
17
+ # correctly comes from mimicing what we find in
18
+ # `active_record/validations/uniqueness.rb`.
19
+ #
7
20
  # @api private
8
21
  class FindWithCase
9
22
  # Dup ActiveRecord.gem_version before freezing, in case someone
@@ -49,25 +62,21 @@ module Authlogic
49
62
  end
50
63
 
51
64
  # @api private
52
- # rubocop:disable Metrics/AbcSize
53
65
  def sensitive_comparison
66
+ bound_value = @model_class.predicate_builder.build_bind_attribute(@field, @value)
54
67
  if AR_GEM_VERSION > Gem::Version.new("5.3")
55
68
  @model_class.connection.case_sensitive_comparison(
56
- @model_class.arel_table[@field], @value
69
+ @model_class.arel_table[@field], bound_value
57
70
  )
58
- elsif AR_GEM_VERSION >= Gem::Version.new("5.0")
71
+ else
59
72
  @model_class.connection.case_sensitive_comparison(
60
73
  @model_class.arel_table,
61
74
  @field,
62
75
  @model_class.columns_hash[@field],
63
- @value
76
+ bound_value
64
77
  )
65
- else
66
- value = @model_class.connection.case_sensitive_modifier(@value, @field)
67
- @model_class.arel_table[@field].eq(value)
68
78
  end
69
79
  end
70
- # rubocop:enable Metrics/AbcSize
71
80
  end
72
81
  end
73
82
  end
@@ -41,6 +41,7 @@ module Authlogic
41
41
  klass.class_eval do
42
42
  include InstanceMethods
43
43
  validates_uniqueness_of :single_access_token,
44
+ case_sensitive: true,
44
45
  if: :will_save_change_to_single_access_token?
45
46
 
46
47
  before_validation :reset_single_access_token, if: :reset_single_access_token?
@@ -17,6 +17,6 @@ module Authlogic
17
17
  #
18
18
  # @api public
19
19
  def self.gem_version
20
- ::Gem::Version.new("5.0.1")
20
+ ::Gem::Version.new("5.0.2")
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Johnson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-02-13 00:00:00.000000000 Z
13
+ date: 2019-04-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -148,6 +148,34 @@ dependencies:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
150
  version: '1.3'
151
+ - !ruby/object:Gem::Dependency
152
+ name: mysql2
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: 0.5.2
158
+ type: :development
159
+ prerelease: false
160
+ version_requirements: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - "~>"
163
+ - !ruby/object:Gem::Version
164
+ version: 0.5.2
165
+ - !ruby/object:Gem::Dependency
166
+ name: pg
167
+ requirement: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - "~>"
170
+ - !ruby/object:Gem::Version
171
+ version: 1.1.4
172
+ type: :development
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - "~>"
177
+ - !ruby/object:Gem::Version
178
+ version: 1.1.4
151
179
  - !ruby/object:Gem::Dependency
152
180
  name: rubocop
153
181
  requirement: !ruby/object:Gem::Requirement
@@ -190,6 +218,48 @@ dependencies:
190
218
  - - "~>"
191
219
  - !ruby/object:Gem::Version
192
220
  version: '0.7'
221
+ - !ruby/object:Gem::Dependency
222
+ name: coveralls
223
+ requirement: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - ">="
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ type: :development
229
+ prerelease: false
230
+ version_requirements: !ruby/object:Gem::Requirement
231
+ requirements:
232
+ - - ">="
233
+ - !ruby/object:Gem::Version
234
+ version: '0'
235
+ - !ruby/object:Gem::Dependency
236
+ name: simplecov
237
+ requirement: !ruby/object:Gem::Requirement
238
+ requirements:
239
+ - - ">"
240
+ - !ruby/object:Gem::Version
241
+ version: '0.16'
242
+ type: :development
243
+ prerelease: false
244
+ version_requirements: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - ">"
247
+ - !ruby/object:Gem::Version
248
+ version: '0.16'
249
+ - !ruby/object:Gem::Dependency
250
+ name: simplecov-console
251
+ requirement: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - ">"
254
+ - !ruby/object:Gem::Version
255
+ version: '0.4'
256
+ type: :development
257
+ prerelease: false
258
+ version_requirements: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - ">"
261
+ - !ruby/object:Gem::Version
262
+ version: '0.4'
193
263
  description:
194
264
  email:
195
265
  - bjohnson@binarylogic.com
@@ -256,8 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
326
  - !ruby/object:Gem::Version
257
327
  version: '0'
258
328
  requirements: []
259
- rubyforge_project:
260
- rubygems_version: 2.7.6
329
+ rubygems_version: 3.0.3
261
330
  signing_key:
262
331
  specification_version: 4
263
332
  summary: An unobtrusive ruby authentication library based on ActiveRecord.