sorcery 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sorcery might be problematic. Click here for more details.

Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -0
  3. data/.rubocop_todo.yml +435 -0
  4. data/.travis.yml +15 -24
  5. data/CHANGELOG.md +19 -0
  6. data/Gemfile +1 -1
  7. data/README.md +25 -5
  8. data/lib/generators/sorcery/templates/initializer.rb +66 -3
  9. data/lib/generators/sorcery/templates/migration/magic_login.rb +9 -0
  10. data/lib/generators/sorcery/templates/migration/reset_password.rb +1 -0
  11. data/lib/sorcery.rb +2 -0
  12. data/lib/sorcery/adapters/active_record_adapter.rb +2 -1
  13. data/lib/sorcery/controller.rb +2 -0
  14. data/lib/sorcery/controller/submodules/external.rb +9 -0
  15. data/lib/sorcery/controller/submodules/session_timeout.rb +1 -1
  16. data/lib/sorcery/model/config.rb +4 -1
  17. data/lib/sorcery/model/submodules/external.rb +15 -0
  18. data/lib/sorcery/model/submodules/magic_login.rb +134 -0
  19. data/lib/sorcery/model/submodules/reset_password.rb +18 -0
  20. data/lib/sorcery/model/temporary_token.rb +3 -1
  21. data/lib/sorcery/providers/vk.rb +3 -2
  22. data/lib/sorcery/test_helpers/rails/request.rb +20 -0
  23. data/lib/sorcery/version.rb +1 -1
  24. data/sorcery.gemspec +6 -5
  25. data/spec/active_record/user_magic_login_spec.rb +15 -0
  26. data/spec/providers/vk_spec.rb +41 -0
  27. data/spec/rails_app/app/mailers/sorcery_mailer.rb +7 -0
  28. data/spec/rails_app/app/views/sorcery_mailer/magic_login_email.html.erb +13 -0
  29. data/spec/rails_app/app/views/sorcery_mailer/magic_login_email.text.erb +6 -0
  30. data/spec/rails_app/db/migrate/magic_login/20170924151831_add_magic_login_to_users.rb +17 -0
  31. data/spec/rails_app/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +2 -0
  32. data/spec/shared_examples/user_magic_login_shared_examples.rb +150 -0
  33. data/spec/shared_examples/user_reset_password_shared_examples.rb +16 -0
  34. data/spec/sorcery_temporary_token_spec.rb +27 -0
  35. metadata +44 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc71bccb13f8e3fcbbf0b94f660a98bc34cc4826
4
- data.tar.gz: 9c60fb5db29c7a41378e7c45234b0b0e9df47501
3
+ metadata.gz: c227363c5ff99b7a5f86b2c485e42dc3992cf360
4
+ data.tar.gz: abee636a51bc09b93b1375e1944081f4c2fc31f0
5
5
  SHA512:
6
- metadata.gz: c557af8ef3828be476750ba465ea4d3c7a34f5ccbf975c5c731d0841891de4f77d56fa867dfd55be9424a2eea0eed768cdfe1a104e6ed70ae643207bb2573eb1
7
- data.tar.gz: 582ea847785099a70c4866feee1b1f891a411e4f572ff89497ac353914cffe78669102d8a7a6b76c208976894ca932f83e61e590645306e7b5a9c3ebc6868bc2
6
+ metadata.gz: f71c6899c5e366555036cd499803984e43bfde61414b634f777d5a4a7b4bbe6799c5c6584c1659e1a19bd97c7b2f5ffcaaea9e7bdb850e3d9bf8dde1e091ef21
7
+ data.tar.gz: 9229f570b78d72193ee5d4b92ec9c1c3862c0860c00e7755f73dd1b0d2bc20690004c758824872744c3a464294f159bb18448e037b287da928a3af66ee76679f
@@ -0,0 +1,5 @@
1
+ # Use auto generated file to ignore existing warnings.
2
+ inherit_from: '.rubocop_todo.yml'
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 2.2
@@ -0,0 +1,435 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-02-03 14:20:34 -0800 using RuboCop version 0.51.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
12
+ # Include: **/Gemfile, **/gems.rb
13
+ Bundler/OrderedGems:
14
+ Exclude:
15
+ - 'Gemfile'
16
+
17
+ # Offense count: 5
18
+ # Cop supports --auto-correct.
19
+ # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
20
+ # Include: **/*.gemspec
21
+ Gemspec/OrderedDependencies:
22
+ Exclude:
23
+ - 'sorcery.gemspec'
24
+
25
+ # Offense count: 7
26
+ # Cop supports --auto-correct.
27
+ Layout/EmptyLines:
28
+ Exclude:
29
+ - 'lib/generators/sorcery/templates/initializer.rb'
30
+
31
+ # Offense count: 2
32
+ # Cop supports --auto-correct.
33
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
34
+ # SupportedStyles: empty_lines, no_empty_lines
35
+ Layout/EmptyLinesAroundBlockBody:
36
+ Exclude:
37
+ - 'spec/rails_app/db/schema.rb'
38
+
39
+ # Offense count: 1
40
+ # Cop supports --auto-correct.
41
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
42
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
43
+ Layout/EmptyLinesAroundClassBody:
44
+ Exclude:
45
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
46
+
47
+ # Offense count: 2
48
+ # Cop supports --auto-correct.
49
+ # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
50
+ Layout/ExtraSpacing:
51
+ Exclude:
52
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
53
+
54
+ # Offense count: 3
55
+ # Cop supports --auto-correct.
56
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
57
+ # SupportedStyles: special_inside_parentheses, consistent, align_braces
58
+ Layout/IndentHash:
59
+ Exclude:
60
+ - 'lib/sorcery/model/submodules/magic_login.rb'
61
+ - 'lib/sorcery/providers/wechat.rb'
62
+
63
+ # Offense count: 2
64
+ # Cop supports --auto-correct.
65
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
66
+ # SupportedStyles: aligned, indented, indented_relative_to_receiver
67
+ Layout/MultilineMethodCallIndentation:
68
+ Exclude:
69
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
70
+
71
+ # Offense count: 2
72
+ # Cop supports --auto-correct.
73
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
74
+ # SupportedStyles: aligned, indented
75
+ Layout/MultilineOperationIndentation:
76
+ Exclude:
77
+ - 'lib/sorcery/model/submodules/magic_login.rb'
78
+
79
+ # Offense count: 2
80
+ # Cop supports --auto-correct.
81
+ Layout/SpaceAfterComma:
82
+ Exclude:
83
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
84
+ - 'spec/controllers/controller_oauth2_spec.rb'
85
+
86
+ # Offense count: 2
87
+ # Cop supports --auto-correct.
88
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
89
+ # SupportedStyles: space, no_space
90
+ Layout/SpaceAroundEqualsInParameterDefault:
91
+ Exclude:
92
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
93
+
94
+ # Offense count: 3
95
+ # Cop supports --auto-correct.
96
+ # Configuration parameters: AllowForAlignment.
97
+ Layout/SpaceAroundOperators:
98
+ Exclude:
99
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
100
+ - 'spec/shared_examples/user_magic_login_shared_examples.rb'
101
+
102
+ # Offense count: 1
103
+ # Cop supports --auto-correct.
104
+ # Configuration parameters: EnforcedStyle, SupportedStyles, SupportedStylesForEmptyBraces.
105
+ # SupportedStyles: space, no_space
106
+ # SupportedStylesForEmptyBraces: space, no_space
107
+ Layout/SpaceBeforeBlockBraces:
108
+ Exclude:
109
+ - 'lib/sorcery/providers/linkedin.rb'
110
+
111
+ # Offense count: 8
112
+ # Cop supports --auto-correct.
113
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
114
+ # SupportedStyles: space, no_space
115
+ # SupportedStylesForEmptyBraces: space, no_space
116
+ Layout/SpaceInsideBlockBraces:
117
+ Exclude:
118
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
119
+ - 'lib/sorcery/providers/linkedin.rb'
120
+ - 'spec/shared_examples/user_magic_login_shared_examples.rb'
121
+
122
+ # Offense count: 4
123
+ # Cop supports --auto-correct.
124
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
125
+ # SupportedStyles: space, no_space, compact
126
+ # SupportedStylesForEmptyBraces: space, no_space
127
+ Layout/SpaceInsideHashLiteralBraces:
128
+ Exclude:
129
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
130
+ - 'lib/sorcery/model/submodules/magic_login.rb'
131
+
132
+ # Offense count: 1
133
+ # Cop supports --auto-correct.
134
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
135
+ # SupportedStyles: final_newline, final_blank_line
136
+ Layout/TrailingBlankLines:
137
+ Exclude:
138
+ - 'lib/sorcery/providers/wechat.rb'
139
+
140
+ # Offense count: 52
141
+ # Cop supports --auto-correct.
142
+ Layout/TrailingWhitespace:
143
+ Exclude:
144
+ - 'lib/sorcery/model/submodules/magic_login.rb'
145
+ - 'spec/active_record/user_magic_login_spec.rb'
146
+ - 'spec/rails_app/app/mailers/sorcery_mailer.rb'
147
+ - 'spec/rails_app/db/migrate/magic_login/20170924151831_add_magic_login_to_users.rb'
148
+ - 'spec/shared_examples/user_magic_login_shared_examples.rb'
149
+
150
+ # Offense count: 1
151
+ Lint/AmbiguousBlockAssociation:
152
+ Exclude:
153
+ - 'spec/shared_examples/user_shared_examples.rb'
154
+
155
+ # Offense count: 28
156
+ # Configuration parameters: AllowSafeAssignment.
157
+ Lint/AssignmentInCondition:
158
+ Exclude:
159
+ - 'lib/sorcery/controller/submodules/external.rb'
160
+ - 'lib/sorcery/providers/vk.rb'
161
+ - 'spec/rails_app/app/controllers/sorcery_controller.rb'
162
+
163
+ # Offense count: 1
164
+ Lint/DuplicateMethods:
165
+ Exclude:
166
+ - 'lib/sorcery/model/config.rb'
167
+
168
+ # Offense count: 1
169
+ # Cop supports --auto-correct.
170
+ # Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
171
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
172
+ Lint/EndAlignment:
173
+ Exclude:
174
+ - 'lib/sorcery/model/config.rb'
175
+
176
+ # Offense count: 5
177
+ Lint/HandleExceptions:
178
+ Exclude:
179
+ - 'lib/sorcery/controller.rb'
180
+ - 'lib/sorcery/model.rb'
181
+ - 'spec/rails_app/config/application.rb'
182
+ - 'spec/shared_examples/user_shared_examples.rb'
183
+
184
+ # Offense count: 1
185
+ Lint/NonLocalExitFromIterator:
186
+ Exclude:
187
+ - 'lib/sorcery/controller.rb'
188
+
189
+ # Offense count: 1
190
+ Lint/ParenthesesAsGroupedExpression:
191
+ Exclude:
192
+ - 'spec/shared_examples/user_remember_me_shared_examples.rb'
193
+
194
+ # Offense count: 3
195
+ Lint/RescueWithoutErrorClass:
196
+ Exclude:
197
+ - 'lib/sorcery/controller/submodules/external.rb'
198
+ - 'spec/shared_examples/user_shared_examples.rb'
199
+ - 'spec/spec_helper.rb'
200
+
201
+ # Offense count: 7
202
+ Lint/UselessAssignment:
203
+ Exclude:
204
+ - 'lib/sorcery/controller/submodules/external.rb'
205
+ - 'lib/sorcery/model/submodules/external.rb'
206
+ - 'spec/controllers/controller_oauth2_spec.rb'
207
+ - 'spec/controllers/controller_remember_me_spec.rb'
208
+
209
+ # Offense count: 2
210
+ Lint/Void:
211
+ Exclude:
212
+ - 'spec/controllers/controller_remember_me_spec.rb'
213
+
214
+ # Offense count: 28
215
+ Metrics/AbcSize:
216
+ Max: 36
217
+
218
+ # Offense count: 73
219
+ # Configuration parameters: CountComments, ExcludedMethods.
220
+ Metrics/BlockLength:
221
+ Max: 391
222
+
223
+ # Offense count: 1
224
+ # Configuration parameters: CountComments.
225
+ Metrics/ClassLength:
226
+ Max: 303
227
+
228
+ # Offense count: 3
229
+ Metrics/CyclomaticComplexity:
230
+ Max: 9
231
+
232
+ # Offense count: 833
233
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
234
+ # URISchemes: http, https
235
+ Metrics/LineLength:
236
+ Max: 323
237
+
238
+ # Offense count: 33
239
+ # Configuration parameters: CountComments.
240
+ Metrics/MethodLength:
241
+ Max: 39
242
+
243
+ # Offense count: 1
244
+ Metrics/PerceivedComplexity:
245
+ Max: 9
246
+
247
+ # Offense count: 11
248
+ Naming/AccessorMethodName:
249
+ Exclude:
250
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
251
+ - 'lib/sorcery/controller/submodules/remember_me.rb'
252
+ - 'lib/sorcery/model/submodules/activity_logging.rb'
253
+ - 'lib/sorcery/protocols/oauth.rb'
254
+ - 'lib/sorcery/providers/jira.rb'
255
+ - 'lib/sorcery/providers/linkedin.rb'
256
+ - 'lib/sorcery/providers/twitter.rb'
257
+ - 'lib/sorcery/providers/xing.rb'
258
+
259
+ # Offense count: 2
260
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
261
+ # NamePrefix: is_, has_, have_
262
+ # NamePrefixBlacklist: is_, has_, have_
263
+ # NameWhitelist: is_a?
264
+ # MethodDefinitionMacros: define_method, define_singleton_method
265
+ Naming/PredicateName:
266
+ Exclude:
267
+ - 'spec/**/*'
268
+ - 'lib/sorcery/model/submodules/remember_me.rb'
269
+ - 'lib/sorcery/providers/base.rb'
270
+
271
+ # Offense count: 1
272
+ # Cop supports --auto-correct.
273
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
274
+ # SupportedStyles: always, conditionals
275
+ Style/AndOr:
276
+ Exclude:
277
+ - 'lib/sorcery/model/submodules/magic_login.rb'
278
+
279
+ # Offense count: 1
280
+ # Cop supports --auto-correct.
281
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
282
+ # SupportedStyles: braces, no_braces, context_dependent
283
+ Style/BracesAroundHashParameters:
284
+ Exclude:
285
+ - 'lib/sorcery/model/submodules/magic_login.rb'
286
+
287
+ # Offense count: 1
288
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
289
+ # SupportedStyles: nested, compact
290
+ Style/ClassAndModuleChildren:
291
+ Exclude:
292
+ - 'lib/sorcery/test_helpers/internal.rb'
293
+
294
+ # Offense count: 2
295
+ Style/DateTime:
296
+ Exclude:
297
+ - 'spec/shared_examples/user_magic_login_shared_examples.rb'
298
+
299
+ # Offense count: 1
300
+ # Cop supports --auto-correct.
301
+ Style/Dir:
302
+ Exclude:
303
+ - 'lib/sorcery/controller/submodules/external.rb'
304
+
305
+ # Offense count: 52
306
+ Style/Documentation:
307
+ Enabled: false
308
+
309
+ # Offense count: 2
310
+ Style/DoubleNegation:
311
+ Exclude:
312
+ - 'lib/generators/sorcery/helpers.rb'
313
+ - 'lib/sorcery/controller.rb'
314
+
315
+ # Offense count: 1
316
+ # Cop supports --auto-correct.
317
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
318
+ # SupportedStyles: format, sprintf, percent
319
+ Style/FormatString:
320
+ Exclude:
321
+ - 'lib/generators/sorcery/install_generator.rb'
322
+
323
+ # Offense count: 16
324
+ # Configuration parameters: MinBodyLength.
325
+ Style/GuardClause:
326
+ Exclude:
327
+ - 'lib/generators/sorcery/install_generator.rb'
328
+ - 'lib/sorcery/controller.rb'
329
+ - 'lib/sorcery/controller/submodules/external.rb'
330
+ - 'lib/sorcery/model.rb'
331
+ - 'lib/sorcery/model/submodules/brute_force_protection.rb'
332
+ - 'lib/sorcery/test_helpers/internal.rb'
333
+ - 'lib/sorcery/test_helpers/internal/rails.rb'
334
+ - 'spec/rails_app/app/controllers/sorcery_controller.rb'
335
+
336
+ # Offense count: 4
337
+ # Cop supports --auto-correct.
338
+ # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
339
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
340
+ Style/HashSyntax:
341
+ Exclude:
342
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
343
+ - 'spec/controllers/controller_oauth2_spec.rb'
344
+ - 'spec/rails_app/db/schema.rb'
345
+
346
+ # Offense count: 1
347
+ Style/MultipleComparison:
348
+ Exclude:
349
+ - 'lib/generators/sorcery/install_generator.rb'
350
+
351
+ # Offense count: 2
352
+ # Cop supports --auto-correct.
353
+ Style/MutableConstant:
354
+ Exclude:
355
+ - 'lib/sorcery/test_helpers/internal/rails.rb'
356
+ - 'lib/sorcery/version.rb'
357
+
358
+ # Offense count: 11
359
+ # Cop supports --auto-correct.
360
+ # Configuration parameters: Strict.
361
+ Style/NumericLiterals:
362
+ MinDigits: 18
363
+
364
+ # Offense count: 1
365
+ # Cop supports --auto-correct.
366
+ # Configuration parameters: AllowSafeAssignment.
367
+ Style/ParenthesesAroundCondition:
368
+ Exclude:
369
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
370
+
371
+ # Offense count: 5
372
+ # Cop supports --auto-correct.
373
+ # Configuration parameters: PreferredDelimiters.
374
+ Style/PercentLiteralDelimiters:
375
+ Exclude:
376
+ - 'lib/sorcery/test_helpers/internal/rails.rb'
377
+ - 'spec/controllers/controller_oauth2_spec.rb'
378
+ - 'spec/rails_app/config/application.rb'
379
+ - 'spec/sorcery_crypto_providers_spec.rb'
380
+
381
+ # Offense count: 1
382
+ # Cop supports --auto-correct.
383
+ Style/RedundantParentheses:
384
+ Exclude:
385
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
386
+
387
+ # Offense count: 4
388
+ # Cop supports --auto-correct.
389
+ Style/RedundantSelf:
390
+ Exclude:
391
+ - 'lib/sorcery/model/submodules/magic_login.rb'
392
+
393
+ # Offense count: 1
394
+ # Cop supports --auto-correct.
395
+ # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
396
+ # SupportedStyles: slashes, percent_r, mixed
397
+ Style/RegexpLiteral:
398
+ Exclude:
399
+ - 'spec/rails_app/config/application.rb'
400
+
401
+ # Offense count: 89
402
+ # Cop supports --auto-correct.
403
+ # Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
404
+ # SupportedStyles: single_quotes, double_quotes
405
+ Style/StringLiterals:
406
+ Exclude:
407
+ - 'lib/sorcery/adapters/mongoid_adapter.rb'
408
+ - 'lib/sorcery/model/submodules/magic_login.rb'
409
+ - 'spec/controllers/controller_oauth2_spec.rb'
410
+ - 'spec/rails_app/db/schema.rb'
411
+ - 'spec/shared_examples/user_magic_login_shared_examples.rb'
412
+
413
+ # Offense count: 22
414
+ # Cop supports --auto-correct.
415
+ # Configuration parameters: MinSize, SupportedStyles.
416
+ # SupportedStyles: percent, brackets
417
+ Style/SymbolArray:
418
+ EnforcedStyle: brackets
419
+
420
+ # Offense count: 1
421
+ # Cop supports --auto-correct.
422
+ # Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
423
+ # SupportedStylesForMultiline: comma, consistent_comma, no_comma
424
+ Style/TrailingCommaInArguments:
425
+ Exclude:
426
+ - 'lib/sorcery/providers/wechat.rb'
427
+
428
+ # Offense count: 2
429
+ # Cop supports --auto-correct.
430
+ # Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
431
+ # SupportedStylesForMultiline: comma, consistent_comma, no_comma
432
+ Style/TrailingCommaInLiteral:
433
+ Exclude:
434
+ - 'lib/sorcery/providers/wechat.rb'
435
+ - 'spec/controllers/controller_oauth2_spec.rb'