authlogic 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +43 -1
- data/.rubocop_todo.yml +23 -132
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTING.md +10 -3
- data/Gemfile +2 -2
- data/Rakefile +6 -6
- data/authlogic.gemspec +13 -12
- data/lib/authlogic/acts_as_authentic/base.rb +12 -7
- data/lib/authlogic/acts_as_authentic/email.rb +16 -6
- data/lib/authlogic/acts_as_authentic/logged_in_status.rb +10 -5
- data/lib/authlogic/acts_as_authentic/login.rb +11 -5
- data/lib/authlogic/acts_as_authentic/password.rb +111 -57
- data/lib/authlogic/acts_as_authentic/perishable_token.rb +6 -2
- data/lib/authlogic/acts_as_authentic/persistence_token.rb +1 -1
- data/lib/authlogic/acts_as_authentic/queries/find_with_case.rb +2 -2
- data/lib/authlogic/acts_as_authentic/restful_authentication.rb +31 -3
- data/lib/authlogic/acts_as_authentic/session_maintenance.rb +11 -3
- data/lib/authlogic/acts_as_authentic/single_access_token.rb +14 -2
- data/lib/authlogic/acts_as_authentic/validations_scope.rb +6 -6
- data/lib/authlogic/authenticates_many/association.rb +2 -2
- data/lib/authlogic/authenticates_many/base.rb +27 -19
- data/lib/authlogic/controller_adapters/rack_adapter.rb +1 -1
- data/lib/authlogic/controller_adapters/rails_adapter.rb +6 -3
- data/lib/authlogic/controller_adapters/sinatra_adapter.rb +2 -2
- data/lib/authlogic/crypto_providers.rb +2 -0
- data/lib/authlogic/crypto_providers/bcrypt.rb +15 -9
- data/lib/authlogic/crypto_providers/md5.rb +2 -1
- data/lib/authlogic/crypto_providers/scrypt.rb +12 -7
- data/lib/authlogic/crypto_providers/sha256.rb +2 -1
- data/lib/authlogic/crypto_providers/wordpress.rb +31 -2
- data/lib/authlogic/i18n.rb +22 -17
- data/lib/authlogic/regex.rb +57 -29
- data/lib/authlogic/session/activation.rb +1 -1
- data/lib/authlogic/session/brute_force_protection.rb +2 -2
- data/lib/authlogic/session/callbacks.rb +43 -36
- data/lib/authlogic/session/cookies.rb +4 -2
- data/lib/authlogic/session/existence.rb +1 -1
- data/lib/authlogic/session/foundation.rb +5 -1
- data/lib/authlogic/session/http_auth.rb +2 -2
- data/lib/authlogic/session/klass.rb +2 -1
- data/lib/authlogic/session/magic_columns.rb +4 -2
- data/lib/authlogic/session/magic_states.rb +9 -10
- data/lib/authlogic/session/params.rb +11 -4
- data/lib/authlogic/session/password.rb +72 -38
- data/lib/authlogic/session/perishable_token.rb +2 -1
- data/lib/authlogic/session/persistence.rb +2 -1
- data/lib/authlogic/session/scopes.rb +26 -16
- data/lib/authlogic/session/unauthorized_record.rb +12 -7
- data/lib/authlogic/session/validation.rb +1 -1
- data/lib/authlogic/test_case/mock_controller.rb +1 -1
- data/lib/authlogic/test_case/mock_cookie_jar.rb +1 -1
- data/lib/authlogic/test_case/mock_request.rb +1 -1
- data/lib/authlogic/version.rb +1 -1
- data/test/acts_as_authentic_test/base_test.rb +1 -1
- data/test/acts_as_authentic_test/email_test.rb +11 -11
- data/test/acts_as_authentic_test/logged_in_status_test.rb +4 -4
- data/test/acts_as_authentic_test/login_test.rb +2 -2
- data/test/acts_as_authentic_test/magic_columns_test.rb +1 -1
- data/test/acts_as_authentic_test/password_test.rb +1 -1
- data/test/acts_as_authentic_test/perishable_token_test.rb +2 -2
- data/test/acts_as_authentic_test/persistence_token_test.rb +1 -1
- data/test/acts_as_authentic_test/restful_authentication_test.rb +12 -3
- data/test/acts_as_authentic_test/session_maintenance_test.rb +1 -1
- data/test/acts_as_authentic_test/single_access_test.rb +1 -1
- data/test/adapter_test.rb +3 -3
- data/test/authenticates_many_test.rb +1 -1
- data/test/config_test.rb +9 -9
- data/test/crypto_provider_test/aes256_test.rb +1 -1
- data/test/crypto_provider_test/bcrypt_test.rb +1 -1
- data/test/crypto_provider_test/scrypt_test.rb +1 -1
- data/test/crypto_provider_test/sha1_test.rb +1 -1
- data/test/crypto_provider_test/sha256_test.rb +1 -1
- data/test/crypto_provider_test/sha512_test.rb +1 -1
- data/test/crypto_provider_test/wordpress_test.rb +24 -0
- data/test/i18n_test.rb +3 -3
- data/test/libs/user_session.rb +2 -2
- data/test/random_test.rb +1 -1
- data/test/session_test/activation_test.rb +1 -1
- data/test/session_test/active_record_trickery_test.rb +3 -3
- data/test/session_test/brute_force_protection_test.rb +1 -1
- data/test/session_test/callbacks_test.rb +9 -3
- data/test/session_test/cookies_test.rb +11 -11
- data/test/session_test/existence_test.rb +1 -1
- data/test/session_test/foundation_test.rb +1 -1
- data/test/session_test/http_auth_test.rb +6 -6
- data/test/session_test/id_test.rb +1 -1
- data/test/session_test/klass_test.rb +1 -1
- data/test/session_test/magic_columns_test.rb +1 -1
- data/test/session_test/magic_states_test.rb +1 -1
- data/test/session_test/params_test.rb +7 -4
- data/test/session_test/password_test.rb +1 -1
- data/test/session_test/perishability_test.rb +1 -1
- data/test/session_test/persistence_test.rb +1 -1
- data/test/session_test/scopes_test.rb +9 -3
- data/test/session_test/session_test.rb +2 -2
- data/test/session_test/timeout_test.rb +1 -1
- data/test/session_test/unauthorized_record_test.rb +1 -1
- data/test/session_test/validation_test.rb +1 -1
- data/test/test_helper.rb +34 -14
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0699061fb6cde9b757291441d3cf7a6621c8f9db98904d98b2864f93297fd0ea
|
4
|
+
data.tar.gz: c95d14549fa390d839b165a223c887562f7a48bd06f545e93faff8e2617207f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cf20428fcff91acadf3724ce63cc30e526019a8cc12d59d7d16e00c9c9e8e15cd3a62208f1ad641bcec0da54456809e98f2594df151826fca85de59aae1f651
|
7
|
+
data.tar.gz: b5d8d535a6633ed8b33805f54e70200e406d9a39061cc87f50852c74df99f3ac33bfb25fbcd47c16eda4467cd02a7f159efb5c35b1ef51f5520b93352b6c2b1d
|
data/.rubocop.yml
CHANGED
@@ -4,7 +4,7 @@ AllCops:
|
|
4
4
|
# You can run the authlogic test suite with any supported version of MRI, but the
|
5
5
|
# linter will only care about this `TargetRubyVersion`. This should be set to the
|
6
6
|
# lowest version of MRI that authlogic supports.
|
7
|
-
TargetRubyVersion: 2.
|
7
|
+
TargetRubyVersion: 2.2
|
8
8
|
|
9
9
|
# Please use normal indentation when aligning parameters.
|
10
10
|
#
|
@@ -32,9 +32,22 @@ Layout/AlignParameters:
|
|
32
32
|
Layout/IndentationConsistency:
|
33
33
|
EnforcedStyle: rails
|
34
34
|
|
35
|
+
Layout/MultilineMethodCallIndentation:
|
36
|
+
EnforcedStyle: indented
|
37
|
+
|
35
38
|
Layout/MultilineOperationIndentation:
|
36
39
|
EnforcedStyle: indented
|
37
40
|
|
41
|
+
Metrics/AbcSize:
|
42
|
+
Exclude:
|
43
|
+
# crypto_providers/wordpress is deprecated so we will not attempt to
|
44
|
+
# improve its quality.
|
45
|
+
- lib/authlogic/crypto_providers/wordpress.rb
|
46
|
+
# In an ideal world tests would be held to the same ABC metric as production
|
47
|
+
# code. In practice, time spent doing so is not nearly as valuable as
|
48
|
+
# spending the same time improving production code.
|
49
|
+
- test/**/*
|
50
|
+
|
38
51
|
# Questionable value compared to metrics like AbcSize or CyclomaticComplexity.
|
39
52
|
Metrics/BlockLength:
|
40
53
|
Enabled: false
|
@@ -43,6 +56,16 @@ Metrics/BlockLength:
|
|
43
56
|
Metrics/ClassLength:
|
44
57
|
Enabled: false
|
45
58
|
|
59
|
+
Metrics/CyclomaticComplexity:
|
60
|
+
Exclude:
|
61
|
+
# crypto_providers/wordpress is deprecated so we will not attempt to
|
62
|
+
# improve its quality.
|
63
|
+
- lib/authlogic/crypto_providers/wordpress.rb
|
64
|
+
|
65
|
+
# Aim for 80, but 100 is OK.
|
66
|
+
Metrics/LineLength:
|
67
|
+
Max: 100
|
68
|
+
|
46
69
|
# Questionable value compared to metrics like AbcSize or CyclomaticComplexity.
|
47
70
|
Metrics/MethodLength:
|
48
71
|
Enabled: false
|
@@ -65,6 +88,11 @@ Naming/HeredocDelimiterNaming:
|
|
65
88
|
Style/EmptyMethod:
|
66
89
|
EnforcedStyle: expanded
|
67
90
|
|
91
|
+
# Avoid annotated tokens except in desperately complicated format strings.
|
92
|
+
# In 99% of format strings they actually make it less readable.
|
93
|
+
Style/FormatStringToken:
|
94
|
+
Enabled: false
|
95
|
+
|
68
96
|
# Too subtle to lint. Guard clauses are great, use them if they help.
|
69
97
|
Style/GuardClause:
|
70
98
|
Enabled: false
|
@@ -87,3 +115,17 @@ Style/ClassAndModuleChildren:
|
|
87
115
|
# they are different (http://bit.ly/2hSQAGm)
|
88
116
|
Style/ModuleFunction:
|
89
117
|
Enabled: false
|
118
|
+
|
119
|
+
# The decision of when to use slashes `/foo/` or percent-r `%r{foo}` is too
|
120
|
+
# subtle to lint. Use whichever requires fewer backslash escapes.
|
121
|
+
Style/RegexpLiteral:
|
122
|
+
AllowInnerSlashes: true
|
123
|
+
|
124
|
+
# We use words, like `$LOAD_PATH`, because they are much less confusing that
|
125
|
+
# arcane symbols like `$:`. Unfortunately, we must then `require "English"` in
|
126
|
+
# a few places, but it's worth it so that we can read our code.
|
127
|
+
Style/SpecialGlobalVars:
|
128
|
+
EnforcedStyle: use_english_names
|
129
|
+
|
130
|
+
Style/StringLiterals:
|
131
|
+
EnforcedStyle: double_quotes
|
data/.rubocop_todo.yml
CHANGED
@@ -8,22 +8,15 @@
|
|
8
8
|
|
9
9
|
# Offense count: 58
|
10
10
|
Metrics/AbcSize:
|
11
|
-
Max:
|
12
|
-
|
13
|
-
# Offense count: 4
|
14
|
-
Metrics/CyclomaticComplexity:
|
15
|
-
Max: 8
|
16
|
-
|
17
|
-
# Offense count: 579
|
18
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
19
|
-
# URISchemes: http, https
|
20
|
-
Metrics/LineLength:
|
21
|
-
Max: 110
|
11
|
+
Max: 28
|
22
12
|
|
23
13
|
# Offense count: 3
|
24
14
|
Metrics/PerceivedComplexity:
|
25
15
|
Max: 8
|
26
16
|
|
17
|
+
Naming/MemoizedInstanceVariableName:
|
18
|
+
Enabled: false
|
19
|
+
|
27
20
|
# Offense count: 60
|
28
21
|
# Cop supports --auto-correct.
|
29
22
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
@@ -38,7 +31,25 @@ Style/ClassVars:
|
|
38
31
|
|
39
32
|
# Offense count: 31
|
40
33
|
Style/Documentation:
|
41
|
-
|
34
|
+
Exclude:
|
35
|
+
# Permanent exclusion
|
36
|
+
- test/**/*
|
37
|
+
|
38
|
+
# Temporary exclustions
|
39
|
+
- lib/authlogic/config.rb
|
40
|
+
- lib/authlogic/controller_adapters/sinatra_adapter.rb
|
41
|
+
- lib/authlogic/crypto_providers.rb
|
42
|
+
- lib/authlogic/i18n/translator.rb
|
43
|
+
- lib/authlogic/session/activation.rb
|
44
|
+
- lib/authlogic/session/active_record_trickery.rb
|
45
|
+
- lib/authlogic/session/existence.rb
|
46
|
+
- lib/authlogic/session/foundation.rb
|
47
|
+
- lib/authlogic/session/klass.rb
|
48
|
+
- lib/authlogic/session/persistence.rb
|
49
|
+
- lib/authlogic/session/scopes.rb
|
50
|
+
- lib/authlogic/test_case.rb
|
51
|
+
- lib/authlogic/test_case/mock_cookie_jar.rb
|
52
|
+
- lib/authlogic/version.rb
|
42
53
|
|
43
54
|
# Offense count: 4
|
44
55
|
Style/MethodMissing:
|
@@ -47,129 +58,9 @@ Style/MethodMissing:
|
|
47
58
|
- 'lib/authlogic/controller_adapters/sinatra_adapter.rb'
|
48
59
|
- 'lib/authlogic/test_case/mock_request.rb'
|
49
60
|
|
50
|
-
# Offense count: 1
|
51
|
-
Style/MixinUsage:
|
52
|
-
Exclude:
|
53
|
-
- 'lib/authlogic/acts_as_authentic/base.rb'
|
54
|
-
|
55
|
-
# Offense count: 2
|
56
|
-
# Cop supports --auto-correct.
|
57
|
-
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
58
|
-
# SupportedStyles: skip_modifier_ifs, always
|
59
|
-
Style/Next:
|
60
|
-
Exclude:
|
61
|
-
- 'lib/authlogic/acts_as_authentic/password.rb'
|
62
|
-
- 'lib/authlogic/session/magic_states.rb'
|
63
|
-
|
64
|
-
# Offense count: 1
|
65
|
-
# Cop supports --auto-correct.
|
66
|
-
Style/Not:
|
67
|
-
Exclude:
|
68
|
-
- 'lib/authlogic/acts_as_authentic/login.rb'
|
69
|
-
|
70
|
-
# Offense count: 2
|
71
|
-
# Cop supports --auto-correct.
|
72
|
-
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
|
73
|
-
# SupportedStyles: predicate, comparison
|
74
|
-
Style/NumericPredicate:
|
75
|
-
Exclude:
|
76
|
-
- 'spec/**/*'
|
77
|
-
- 'lib/authlogic/acts_as_authentic/password.rb'
|
78
|
-
- 'lib/authlogic/session/brute_force_protection.rb'
|
79
|
-
|
80
|
-
# Offense count: 1
|
81
|
-
# Cop supports --auto-correct.
|
82
|
-
# Configuration parameters: AllowSafeAssignment.
|
83
|
-
Style/ParenthesesAroundCondition:
|
84
|
-
Exclude:
|
85
|
-
- 'test/test_helper.rb'
|
86
|
-
|
87
|
-
# Offense count: 3
|
88
|
-
# Cop supports --auto-correct.
|
89
|
-
Style/Proc:
|
90
|
-
Exclude:
|
91
|
-
- 'lib/authlogic/acts_as_authentic/email.rb'
|
92
|
-
- 'lib/authlogic/session/http_auth.rb'
|
93
|
-
- 'test/acts_as_authentic_test/email_test.rb'
|
94
|
-
|
95
61
|
# Offense count: 7
|
96
62
|
# Cop supports --auto-correct.
|
97
63
|
# Configuration parameters: SupportedStyles.
|
98
64
|
# SupportedStyles: compact, exploded
|
99
65
|
Style/RaiseArgs:
|
100
66
|
EnforcedStyle: compact
|
101
|
-
|
102
|
-
# Offense count: 3
|
103
|
-
# Cop supports --auto-correct.
|
104
|
-
Style/RedundantBegin:
|
105
|
-
Exclude:
|
106
|
-
- 'lib/authlogic/acts_as_authentic/base.rb'
|
107
|
-
- 'lib/authlogic/crypto_providers/bcrypt.rb'
|
108
|
-
- 'lib/authlogic/crypto_providers/scrypt.rb'
|
109
|
-
|
110
|
-
# Offense count: 4
|
111
|
-
# Cop supports --auto-correct.
|
112
|
-
# Configuration parameters: AllowMultipleReturnValues.
|
113
|
-
Style/RedundantReturn:
|
114
|
-
Exclude:
|
115
|
-
- 'lib/authlogic/acts_as_authentic/session_maintenance.rb'
|
116
|
-
- 'test/libs/user_session.rb'
|
117
|
-
|
118
|
-
# Offense count: 3
|
119
|
-
# Cop supports --auto-correct.
|
120
|
-
Style/RedundantSelf:
|
121
|
-
Exclude:
|
122
|
-
- 'lib/authlogic/acts_as_authentic/perishable_token.rb'
|
123
|
-
- 'lib/authlogic/acts_as_authentic/restful_authentication.rb'
|
124
|
-
- 'lib/authlogic/controller_adapters/rack_adapter.rb'
|
125
|
-
|
126
|
-
# Offense count: 1
|
127
|
-
# Cop supports --auto-correct.
|
128
|
-
Style/RescueModifier:
|
129
|
-
Exclude:
|
130
|
-
- 'lib/authlogic/acts_as_authentic/session_maintenance.rb'
|
131
|
-
|
132
|
-
# Offense count: 1
|
133
|
-
# Cop supports --auto-correct.
|
134
|
-
# Configuration parameters: SupportedStyles.
|
135
|
-
# SupportedStyles: use_perl_names, use_english_names
|
136
|
-
Style/SpecialGlobalVars:
|
137
|
-
EnforcedStyle: use_perl_names
|
138
|
-
|
139
|
-
# Offense count: 507
|
140
|
-
# Cop supports --auto-correct.
|
141
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
142
|
-
# SupportedStyles: single_quotes, double_quotes
|
143
|
-
Style/StringLiterals:
|
144
|
-
Enabled: false
|
145
|
-
|
146
|
-
# Offense count: 2
|
147
|
-
# Cop supports --auto-correct.
|
148
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
149
|
-
# SupportedStyles: single_quotes, double_quotes
|
150
|
-
Style/StringLiteralsInInterpolation:
|
151
|
-
Exclude:
|
152
|
-
- 'lib/authlogic/authenticates_many/base.rb'
|
153
|
-
- 'lib/authlogic/session/foundation.rb'
|
154
|
-
|
155
|
-
# Offense count: 8
|
156
|
-
# Cop supports --auto-correct.
|
157
|
-
# Configuration parameters: MinSize, SupportedStyles.
|
158
|
-
# SupportedStyles: percent, brackets
|
159
|
-
Style/SymbolArray:
|
160
|
-
EnforcedStyle: brackets
|
161
|
-
|
162
|
-
# Offense count: 1
|
163
|
-
# Cop supports --auto-correct.
|
164
|
-
# Configuration parameters: IgnoredMethods.
|
165
|
-
# IgnoredMethods: respond_to, define_method
|
166
|
-
Style/SymbolProc:
|
167
|
-
Exclude:
|
168
|
-
- 'lib/authlogic/acts_as_authentic/persistence_token.rb'
|
169
|
-
|
170
|
-
# Offense count: 2
|
171
|
-
# Cop supports --auto-correct.
|
172
|
-
# Configuration parameters: SupportedStyles, MinSize, WordRegex.
|
173
|
-
# SupportedStyles: percent, brackets
|
174
|
-
Style/WordArray:
|
175
|
-
EnforcedStyle: brackets
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,18 @@
|
|
9
9
|
* Fixed
|
10
10
|
* None
|
11
11
|
|
12
|
+
## 4.1.0 (2018-04-24)
|
13
|
+
|
14
|
+
* Breaking Changes
|
15
|
+
* None
|
16
|
+
* Added
|
17
|
+
* None
|
18
|
+
* Fixed
|
19
|
+
* None
|
20
|
+
* Deprecated
|
21
|
+
* crypto_providers/wordpress.rb, without replacement
|
22
|
+
* restful_authentication, without replacement
|
23
|
+
|
12
24
|
## 4.0.1 (2018-03-20)
|
13
25
|
|
14
26
|
* Breaking Changes
|
data/CONTRIBUTING.md
CHANGED
@@ -41,7 +41,14 @@ To run a single test:
|
|
41
41
|
|
42
42
|
```
|
43
43
|
BUNDLE_GEMFILE=test/gemfiles/Gemfile.rails-4.2.x \
|
44
|
-
bundle exec ruby
|
44
|
+
bundle exec ruby -I test path/to/test.rb
|
45
|
+
```
|
46
|
+
|
47
|
+
Bundler can be omitted, and the latest installed version of a gem dependency
|
48
|
+
will be used. This is only suitable for certain unit tests.
|
49
|
+
|
50
|
+
```
|
51
|
+
ruby –I test path/to/test.rb
|
45
52
|
```
|
46
53
|
|
47
54
|
### Linting
|
@@ -50,13 +57,13 @@ Running `rake` also runs a linter, rubocop. Contributions must pass both
|
|
50
57
|
the linter and the tests. The linter can be run on its own.
|
51
58
|
|
52
59
|
```
|
53
|
-
BUNDLE_GEMFILE=test/gemfiles/Gemfile.rails-
|
60
|
+
BUNDLE_GEMFILE=test/gemfiles/Gemfile.rails-4.2.x bundle exec rubocop
|
54
61
|
```
|
55
62
|
|
56
63
|
To run the tests without linting, use `rake test`.
|
57
64
|
|
58
65
|
```
|
59
|
-
BUNDLE_GEMFILE=test/gemfiles/Gemfile.rails-
|
66
|
+
BUNDLE_GEMFILE=test/gemfiles/Gemfile.rails-4.2.x bundle exec rake test
|
60
67
|
```
|
61
68
|
|
62
69
|
### Release
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler"
|
3
3
|
|
4
4
|
Bundler.setup
|
5
5
|
|
6
|
-
require
|
6
|
+
require "rake/testtask"
|
7
7
|
Rake::TestTask.new(:test) do |test|
|
8
|
-
test.libs <<
|
9
|
-
test.pattern =
|
8
|
+
test.libs << "test"
|
9
|
+
test.pattern = "test/**/*_test.rb"
|
10
10
|
test.verbose = false
|
11
11
|
|
12
12
|
# Set interpreter warning level to 1 (medium). Level 2 produces hundreds of warnings
|
@@ -18,4 +18,4 @@ end
|
|
18
18
|
require "rubocop/rake_task"
|
19
19
|
RuboCop::RakeTask.new
|
20
20
|
|
21
|
-
task default: [
|
21
|
+
task default: %i[rubocop test]
|
data/authlogic.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
require "English"
|
2
|
+
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
2
3
|
require "authlogic/version"
|
3
4
|
|
4
5
|
::Gem::Specification.new do |s|
|
@@ -16,18 +17,18 @@ require "authlogic/version"
|
|
16
17
|
"jared@jaredbeck.com"
|
17
18
|
]
|
18
19
|
s.homepage = "http://github.com/binarylogic/authlogic"
|
19
|
-
s.summary =
|
20
|
-
s.license =
|
20
|
+
s.summary = "A clean, simple, and unobtrusive ruby authentication solution."
|
21
|
+
s.license = "MIT"
|
21
22
|
|
22
|
-
s.required_ruby_version =
|
23
|
-
s.add_dependency
|
24
|
-
s.add_dependency
|
25
|
-
s.add_dependency
|
26
|
-
s.add_dependency
|
27
|
-
s.add_development_dependency
|
28
|
-
s.add_development_dependency
|
29
|
-
s.add_development_dependency
|
30
|
-
s.add_development_dependency
|
23
|
+
s.required_ruby_version = ">= 2.2.0"
|
24
|
+
s.add_dependency "activerecord", [">= 4.2", "< 5.3"]
|
25
|
+
s.add_dependency "activesupport", [">= 4.2", "< 5.3"]
|
26
|
+
s.add_dependency "request_store", "~> 1.0"
|
27
|
+
s.add_dependency "scrypt", ">= 1.2", "< 4.0"
|
28
|
+
s.add_development_dependency "bcrypt", "~> 3.1"
|
29
|
+
s.add_development_dependency "byebug", "~> 10.0"
|
30
|
+
s.add_development_dependency "rubocop", "~> 0.54.0"
|
31
|
+
s.add_development_dependency "timecop", "~> 0.7"
|
31
32
|
|
32
33
|
s.files = `git ls-files`.split("\n")
|
33
34
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -11,6 +11,8 @@ module Authlogic
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
# The primary configuration of a model (often, `User`) for use with
|
15
|
+
# authlogic. These methods become class methods of ::ActiveRecord::Base.
|
14
16
|
module Config
|
15
17
|
# This includes a lot of helpful methods for authenticating records
|
16
18
|
# which the Authlogic::Session module relies on. To use it just do:
|
@@ -64,7 +66,8 @@ module Authlogic
|
|
64
66
|
self.acts_as_authentic_modules = modules
|
65
67
|
end
|
66
68
|
|
67
|
-
# This is the same as add_acts_as_authentic_module, except that it
|
69
|
+
# This is the same as add_acts_as_authentic_module, except that it
|
70
|
+
# removes the module from the list.
|
68
71
|
def remove_acts_as_authentic_module(mod)
|
69
72
|
modules = acts_as_authentic_modules.clone
|
70
73
|
modules.delete(mod)
|
@@ -74,12 +77,10 @@ module Authlogic
|
|
74
77
|
private
|
75
78
|
|
76
79
|
def db_setup?
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
false
|
82
|
-
end
|
80
|
+
column_names
|
81
|
+
true
|
82
|
+
rescue StandardError
|
83
|
+
false
|
83
84
|
end
|
84
85
|
|
85
86
|
def first_column_to_exist(*columns_to_check)
|
@@ -105,7 +106,11 @@ end
|
|
105
106
|
::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Password
|
106
107
|
::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::PerishableToken
|
107
108
|
::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::PersistenceToken
|
109
|
+
|
110
|
+
# RestfulAuthentication is deprecated. See comments in
|
111
|
+
# acts_as_authentic/restful_authentication.rb
|
108
112
|
::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::RestfulAuthentication
|
113
|
+
|
109
114
|
::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::SessionMaintenance
|
110
115
|
::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::SingleAccessToken
|
111
116
|
::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::ValidationsScope
|
@@ -46,7 +46,10 @@ module Authlogic
|
|
46
46
|
def validates_length_of_email_field_options(value = nil)
|
47
47
|
rw_config(:validates_length_of_email_field_options, value, maximum: 100)
|
48
48
|
end
|
49
|
-
alias_method
|
49
|
+
alias_method(
|
50
|
+
:validates_length_of_email_field_options=,
|
51
|
+
:validates_length_of_email_field_options
|
52
|
+
)
|
50
53
|
|
51
54
|
# A convenience function to merge options into the
|
52
55
|
# validates_length_of_email_field_options. So instead of:
|
@@ -73,7 +76,11 @@ module Authlogic
|
|
73
76
|
# To validate international email addresses, enable the provided
|
74
77
|
# alternate regex:
|
75
78
|
#
|
76
|
-
#
|
79
|
+
# ```
|
80
|
+
# validates_format_of_email_field_options(
|
81
|
+
# with: Authlogic::Regex.email_nonascii
|
82
|
+
# )
|
83
|
+
# ```
|
77
84
|
#
|
78
85
|
# * <tt>Default:</tt>
|
79
86
|
#
|
@@ -92,16 +99,19 @@ module Authlogic
|
|
92
99
|
rw_config(
|
93
100
|
:validates_format_of_email_field_options,
|
94
101
|
value,
|
95
|
-
with: Authlogic::Regex
|
96
|
-
message:
|
102
|
+
with: Authlogic::Regex::EMAIL,
|
103
|
+
message: proc do
|
97
104
|
I18n.t(
|
98
|
-
|
105
|
+
"error_messages.email_invalid",
|
99
106
|
default: "should look like an email address."
|
100
107
|
)
|
101
108
|
end
|
102
109
|
)
|
103
110
|
end
|
104
|
-
alias_method
|
111
|
+
alias_method(
|
112
|
+
:validates_format_of_email_field_options=,
|
113
|
+
:validates_format_of_email_field_options
|
114
|
+
)
|
105
115
|
|
106
116
|
# See merge_validates_length_of_email_field_options. The same thing
|
107
117
|
# except for validates_format_of_email_field_options.
|