authlogic 4.0.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +43 -1
  3. data/.rubocop_todo.yml +23 -132
  4. data/CHANGELOG.md +12 -0
  5. data/CONTRIBUTING.md +10 -3
  6. data/Gemfile +2 -2
  7. data/Rakefile +6 -6
  8. data/authlogic.gemspec +13 -12
  9. data/lib/authlogic/acts_as_authentic/base.rb +12 -7
  10. data/lib/authlogic/acts_as_authentic/email.rb +16 -6
  11. data/lib/authlogic/acts_as_authentic/logged_in_status.rb +10 -5
  12. data/lib/authlogic/acts_as_authentic/login.rb +11 -5
  13. data/lib/authlogic/acts_as_authentic/password.rb +111 -57
  14. data/lib/authlogic/acts_as_authentic/perishable_token.rb +6 -2
  15. data/lib/authlogic/acts_as_authentic/persistence_token.rb +1 -1
  16. data/lib/authlogic/acts_as_authentic/queries/find_with_case.rb +2 -2
  17. data/lib/authlogic/acts_as_authentic/restful_authentication.rb +31 -3
  18. data/lib/authlogic/acts_as_authentic/session_maintenance.rb +11 -3
  19. data/lib/authlogic/acts_as_authentic/single_access_token.rb +14 -2
  20. data/lib/authlogic/acts_as_authentic/validations_scope.rb +6 -6
  21. data/lib/authlogic/authenticates_many/association.rb +2 -2
  22. data/lib/authlogic/authenticates_many/base.rb +27 -19
  23. data/lib/authlogic/controller_adapters/rack_adapter.rb +1 -1
  24. data/lib/authlogic/controller_adapters/rails_adapter.rb +6 -3
  25. data/lib/authlogic/controller_adapters/sinatra_adapter.rb +2 -2
  26. data/lib/authlogic/crypto_providers.rb +2 -0
  27. data/lib/authlogic/crypto_providers/bcrypt.rb +15 -9
  28. data/lib/authlogic/crypto_providers/md5.rb +2 -1
  29. data/lib/authlogic/crypto_providers/scrypt.rb +12 -7
  30. data/lib/authlogic/crypto_providers/sha256.rb +2 -1
  31. data/lib/authlogic/crypto_providers/wordpress.rb +31 -2
  32. data/lib/authlogic/i18n.rb +22 -17
  33. data/lib/authlogic/regex.rb +57 -29
  34. data/lib/authlogic/session/activation.rb +1 -1
  35. data/lib/authlogic/session/brute_force_protection.rb +2 -2
  36. data/lib/authlogic/session/callbacks.rb +43 -36
  37. data/lib/authlogic/session/cookies.rb +4 -2
  38. data/lib/authlogic/session/existence.rb +1 -1
  39. data/lib/authlogic/session/foundation.rb +5 -1
  40. data/lib/authlogic/session/http_auth.rb +2 -2
  41. data/lib/authlogic/session/klass.rb +2 -1
  42. data/lib/authlogic/session/magic_columns.rb +4 -2
  43. data/lib/authlogic/session/magic_states.rb +9 -10
  44. data/lib/authlogic/session/params.rb +11 -4
  45. data/lib/authlogic/session/password.rb +72 -38
  46. data/lib/authlogic/session/perishable_token.rb +2 -1
  47. data/lib/authlogic/session/persistence.rb +2 -1
  48. data/lib/authlogic/session/scopes.rb +26 -16
  49. data/lib/authlogic/session/unauthorized_record.rb +12 -7
  50. data/lib/authlogic/session/validation.rb +1 -1
  51. data/lib/authlogic/test_case/mock_controller.rb +1 -1
  52. data/lib/authlogic/test_case/mock_cookie_jar.rb +1 -1
  53. data/lib/authlogic/test_case/mock_request.rb +1 -1
  54. data/lib/authlogic/version.rb +1 -1
  55. data/test/acts_as_authentic_test/base_test.rb +1 -1
  56. data/test/acts_as_authentic_test/email_test.rb +11 -11
  57. data/test/acts_as_authentic_test/logged_in_status_test.rb +4 -4
  58. data/test/acts_as_authentic_test/login_test.rb +2 -2
  59. data/test/acts_as_authentic_test/magic_columns_test.rb +1 -1
  60. data/test/acts_as_authentic_test/password_test.rb +1 -1
  61. data/test/acts_as_authentic_test/perishable_token_test.rb +2 -2
  62. data/test/acts_as_authentic_test/persistence_token_test.rb +1 -1
  63. data/test/acts_as_authentic_test/restful_authentication_test.rb +12 -3
  64. data/test/acts_as_authentic_test/session_maintenance_test.rb +1 -1
  65. data/test/acts_as_authentic_test/single_access_test.rb +1 -1
  66. data/test/adapter_test.rb +3 -3
  67. data/test/authenticates_many_test.rb +1 -1
  68. data/test/config_test.rb +9 -9
  69. data/test/crypto_provider_test/aes256_test.rb +1 -1
  70. data/test/crypto_provider_test/bcrypt_test.rb +1 -1
  71. data/test/crypto_provider_test/scrypt_test.rb +1 -1
  72. data/test/crypto_provider_test/sha1_test.rb +1 -1
  73. data/test/crypto_provider_test/sha256_test.rb +1 -1
  74. data/test/crypto_provider_test/sha512_test.rb +1 -1
  75. data/test/crypto_provider_test/wordpress_test.rb +24 -0
  76. data/test/i18n_test.rb +3 -3
  77. data/test/libs/user_session.rb +2 -2
  78. data/test/random_test.rb +1 -1
  79. data/test/session_test/activation_test.rb +1 -1
  80. data/test/session_test/active_record_trickery_test.rb +3 -3
  81. data/test/session_test/brute_force_protection_test.rb +1 -1
  82. data/test/session_test/callbacks_test.rb +9 -3
  83. data/test/session_test/cookies_test.rb +11 -11
  84. data/test/session_test/existence_test.rb +1 -1
  85. data/test/session_test/foundation_test.rb +1 -1
  86. data/test/session_test/http_auth_test.rb +6 -6
  87. data/test/session_test/id_test.rb +1 -1
  88. data/test/session_test/klass_test.rb +1 -1
  89. data/test/session_test/magic_columns_test.rb +1 -1
  90. data/test/session_test/magic_states_test.rb +1 -1
  91. data/test/session_test/params_test.rb +7 -4
  92. data/test/session_test/password_test.rb +1 -1
  93. data/test/session_test/perishability_test.rb +1 -1
  94. data/test/session_test/persistence_test.rb +1 -1
  95. data/test/session_test/scopes_test.rb +9 -3
  96. data/test/session_test/session_test.rb +2 -2
  97. data/test/session_test/timeout_test.rb +1 -1
  98. data/test/session_test/unauthorized_record_test.rb +1 -1
  99. data/test/session_test/validation_test.rb +1 -1
  100. data/test/test_helper.rb +34 -14
  101. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f8b47d1c4c842aff31f1d7b9851725d60773e2eea798f9adafe1e479476c5cb
4
- data.tar.gz: b46bc3d9c1e08d9680ca434795d832379a3bef437b755f978c3e4d3defd47330
3
+ metadata.gz: 0699061fb6cde9b757291441d3cf7a6621c8f9db98904d98b2864f93297fd0ea
4
+ data.tar.gz: c95d14549fa390d839b165a223c887562f7a48bd06f545e93faff8e2617207f4
5
5
  SHA512:
6
- metadata.gz: d4852862fc120c4c7d0f7333ee43aac4d12658db42db9ac6bb570dfae45bb3f250ebe38e8459ebae4042d6a1d0fdcad4be86f48d685dfd2635c0d90a92c899a6
7
- data.tar.gz: 1371934081cd37bde0ac6e5c8ef8e3b932c050aafbfa50b022d75d48549397e303c4a5cc42a4da767b864d963a89f5f8ab370beb30a6f76f28b6ff025bf91082
6
+ metadata.gz: 0cf20428fcff91acadf3724ce63cc30e526019a8cc12d59d7d16e00c9c9e8e15cd3a62208f1ad641bcec0da54456809e98f2594df151826fca85de59aae1f651
7
+ data.tar.gz: b5d8d535a6633ed8b33805f54e70200e406d9a39061cc87f50852c74df99f3ac33bfb25fbcd47c16eda4467cd02a7f159efb5c35b1ef51f5520b93352b6c2b1d
@@ -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.1
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
@@ -8,22 +8,15 @@
8
8
 
9
9
  # Offense count: 58
10
10
  Metrics/AbcSize:
11
- Max: 43
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
- Enabled: false
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
@@ -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
@@ -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 I test path/to/test.rb
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-3.2.x bundle exec rubocop
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-3.2.x bundle exec rake test
66
+ BUNDLE_GEMFILE=test/gemfiles/Gemfile.rails-4.2.x bundle exec rake test
60
67
  ```
61
68
 
62
69
  ### Release
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
- gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
5
- gem 'sqlite3', platforms: :ruby
4
+ gem "activerecord-jdbcsqlite3-adapter", platforms: :jruby
5
+ gem "sqlite3", platforms: :ruby
data/Rakefile CHANGED
@@ -1,12 +1,12 @@
1
- require 'rubygems'
2
- require 'bundler'
1
+ require "rubygems"
2
+ require "bundler"
3
3
 
4
4
  Bundler.setup
5
5
 
6
- require 'rake/testtask'
6
+ require "rake/testtask"
7
7
  Rake::TestTask.new(:test) do |test|
8
- test.libs << 'test'
9
- test.pattern = 'test/**/*_test.rb'
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: [:rubocop, :test]
21
+ task default: %i[rubocop test]
@@ -1,4 +1,5 @@
1
- $:.push File.expand_path("../lib", __FILE__)
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 = 'A clean, simple, and unobtrusive ruby authentication solution.'
20
- s.license = 'MIT'
20
+ s.summary = "A clean, simple, and unobtrusive ruby authentication solution."
21
+ s.license = "MIT"
21
22
 
22
- s.required_ruby_version = '>= 2.2.0'
23
- s.add_dependency 'activerecord', ['>= 4.2', '< 5.3']
24
- s.add_dependency 'activesupport', ['>= 4.2', '< 5.3']
25
- s.add_dependency 'request_store', '~> 1.0'
26
- s.add_dependency 'scrypt', '>= 1.2', '< 4.0'
27
- s.add_development_dependency 'bcrypt', '~> 3.1'
28
- s.add_development_dependency 'byebug', '~> 10.0'
29
- s.add_development_dependency 'rubocop', '~> 0.51.0'
30
- s.add_development_dependency 'timecop', '~> 0.7'
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 removes the module from the list.
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
- begin
78
- column_names
79
- true
80
- rescue StandardError
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 :validates_length_of_email_field_options=, :validates_length_of_email_field_options
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
- # * <tt>validates_format_of_email_field_options({:with => Authlogic::Regex.email_nonascii})</tt>
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.email,
96
- message: Proc.new do
102
+ with: Authlogic::Regex::EMAIL,
103
+ message: proc do
97
104
  I18n.t(
98
- 'error_messages.email_invalid',
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 :validates_format_of_email_field_options=, :validates_format_of_email_field_options
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.