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 +4 -4
- data/lib/authlogic/acts_as_authentic/perishable_token.rb +2 -1
- data/lib/authlogic/acts_as_authentic/persistence_token.rb +2 -1
- data/lib/authlogic/acts_as_authentic/queries/find_with_case.rb +17 -8
- data/lib/authlogic/acts_as_authentic/single_access_token.rb +1 -0
- data/lib/authlogic/version.rb +1 -1
- metadata +73 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a7be80a92ba37ae9c3456108c6cb5644b8dc0269dcc2c8224430258d82d2b4f
|
4
|
+
data.tar.gz: 7973eb69191803b240996d0e0f9c936546f4c4deb1f4f782641f12e5e2bb1816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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,
|
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],
|
69
|
+
@model_class.arel_table[@field], bound_value
|
57
70
|
)
|
58
|
-
|
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
|
-
|
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?
|
data/lib/authlogic/version.rb
CHANGED
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.
|
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-
|
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
|
-
|
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.
|