solidus_auth_devise 2.5.9 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.git-blame-ignore-revs +2 -0
  3. data/.github/workflows/test.yml +22 -0
  4. data/.rubocop.yml +0 -8
  5. data/Gemfile +33 -19
  6. data/README.md +1 -1
  7. data/Rakefile +5 -5
  8. data/app/models/spree/user.rb +3 -12
  9. data/app/patches/controllers/solidus_auth_devise/application_controller_patch.rb +29 -0
  10. data/bin/rspec +16 -0
  11. data/config/initializers/devise.rb +7 -5
  12. data/config/routes.rb +31 -31
  13. data/db/default/users.rb +5 -5
  14. data/db/migrate/20101026184949_create_users.rb +19 -19
  15. data/db/migrate/20101026184950_rename_columns_for_devise.rb +1 -3
  16. data/db/migrate/20101214150824_convert_user_remember_field.rb +1 -1
  17. data/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb +1 -1
  18. data/db/migrate/20120605211305_make_users_email_index_unique.rb +1 -1
  19. data/db/migrate/20140904000425_add_deleted_at_to_users.rb +1 -1
  20. data/db/migrate/20141002154641_add_confirmable_to_users.rb +1 -1
  21. data/db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb +3 -3
  22. data/db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb +1 -1
  23. data/db/seeds.rb +1 -1
  24. data/lib/controllers/backend/spree/admin/user_passwords_controller.rb +3 -3
  25. data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +7 -7
  26. data/lib/controllers/frontend/spree/user_confirmations_controller.rb +1 -1
  27. data/lib/controllers/frontend/spree/user_passwords_controller.rb +2 -2
  28. data/lib/controllers/frontend/spree/user_registrations_controller.rb +2 -2
  29. data/lib/controllers/frontend/spree/user_sessions_controller.rb +6 -6
  30. data/lib/controllers/frontend/spree/users_controller.rb +5 -4
  31. data/lib/generators/solidus/auth/install/install_generator.rb +7 -7
  32. data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb.erb +4 -0
  33. data/lib/generators/solidus_auth_devise/install/install_generator.rb +2 -2
  34. data/lib/{decorators/backend/controllers/spree/admin/base_controller_decorator.rb → patches/backend/controllers/solidus_auth_devise/admin/base_controller_patch.rb} +2 -2
  35. data/lib/patches/backend/controllers/solidus_auth_devise/admin/orders/customer_details_controller_patch.rb +28 -0
  36. data/lib/{decorators/frontend/controllers/spree/checkout_controller_decorator.rb → patches/frontend/controllers/solidus_auth_devise/checkout_controller_patch.rb} +7 -7
  37. data/lib/solidus_auth_devise/configuration.rb +1 -1
  38. data/lib/solidus_auth_devise/engine.rb +1 -1
  39. data/lib/solidus_auth_devise/version.rb +1 -1
  40. data/lib/solidus_auth_devise.rb +9 -11
  41. data/lib/spree/auth/engine.rb +10 -15
  42. data/lib/spree/auth/version.rb +1 -1
  43. data/lib/tasks/auth.rake +1 -1
  44. data/solidus_auth_devise.gemspec +20 -21
  45. metadata +19 -96
  46. data/.circleci/config.yml +0 -73
  47. data/.rubocop_todo.yml +0 -397
  48. data/lib/decorators/backend/controllers/spree/admin/orders/customer_details_controller_decorator.rb +0 -22
  49. data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb +0 -3
  50. data/lib/spree/authentication_helpers.rb +0 -27
  51. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -53
  52. data/spec/controllers/spree/admin/user_passwords_controller_spec.rb +0 -14
  53. data/spec/controllers/spree/admin/user_sessions_controller_spec.rb +0 -20
  54. data/spec/controllers/spree/base_controller_spec.rb +0 -53
  55. data/spec/controllers/spree/checkout_controller_spec.rb +0 -192
  56. data/spec/controllers/spree/products_controller_spec.rb +0 -24
  57. data/spec/controllers/spree/user_passwords_controller_spec.rb +0 -45
  58. data/spec/controllers/spree/user_registrations_controller_spec.rb +0 -97
  59. data/spec/controllers/spree/user_sessions_controller_spec.rb +0 -125
  60. data/spec/controllers/spree/users_controller_spec.rb +0 -79
  61. data/spec/factories/confirmed_user.rb +0 -9
  62. data/spec/features/account_spec.rb +0 -59
  63. data/spec/features/admin/password_reset_spec.rb +0 -80
  64. data/spec/features/admin/products_spec.rb +0 -10
  65. data/spec/features/admin/sign_in_spec.rb +0 -45
  66. data/spec/features/admin/sign_out_spec.rb +0 -42
  67. data/spec/features/admin_permissions_spec.rb +0 -47
  68. data/spec/features/change_email_spec.rb +0 -27
  69. data/spec/features/checkout_spec.rb +0 -158
  70. data/spec/features/confirmation_spec.rb +0 -28
  71. data/spec/features/order_spec.rb +0 -59
  72. data/spec/features/password_reset_spec.rb +0 -37
  73. data/spec/features/sign_in_spec.rb +0 -53
  74. data/spec/features/sign_out_spec.rb +0 -26
  75. data/spec/features/sign_up_spec.rb +0 -31
  76. data/spec/mailers/user_mailer_spec.rb +0 -47
  77. data/spec/models/order_spec.rb +0 -27
  78. data/spec/models/user_spec.rb +0 -103
  79. data/spec/requests/spree/frontend/user_update_spec.rb +0 -42
  80. data/spec/spec_helper.rb +0 -33
  81. data/spec/support/ability.rb +0 -17
  82. data/spec/support/authentication_helpers.rb +0 -16
  83. data/spec/support/confirm_helpers.rb +0 -27
  84. data/spec/support/email.rb +0 -7
  85. data/spec/support/features/fill_addresses_fields.rb +0 -29
  86. data/spec/support/preferences.rb +0 -13
  87. data/spec/support/spree.rb +0 -11
data/.rubocop_todo.yml DELETED
@@ -1,397 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2022-09-09 11:12:37 UTC using RuboCop version 1.36.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: 2
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
- # Include: **/*.gemspec
13
- Gemspec/OrderedDependencies:
14
- Exclude:
15
- - 'solidus_auth_devise.gemspec'
16
-
17
- # Offense count: 8
18
- # This cop supports safe autocorrection (--autocorrect).
19
- # Configuration parameters: EnforcedStyle, IndentationWidth.
20
- # SupportedStyles: with_first_argument, with_fixed_indentation
21
- Layout/ArgumentAlignment:
22
- Exclude:
23
- - 'app/models/spree/user.rb'
24
- - 'lib/spree/authentication_helpers.rb'
25
- - 'spec/controllers/spree/user_sessions_controller_spec.rb'
26
- - 'spec/features/sign_out_spec.rb'
27
-
28
- # Offense count: 2
29
- # This cop supports safe autocorrection (--autocorrect).
30
- Layout/ElseAlignment:
31
- Exclude:
32
- - 'config/initializers/devise.rb'
33
- - 'spec/support/features/fill_addresses_fields.rb'
34
-
35
- # Offense count: 1
36
- # This cop supports safe autocorrection (--autocorrect).
37
- # Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
38
- Layout/EmptyLineBetweenDefs:
39
- Exclude:
40
- - 'lib/spree/auth/engine.rb'
41
-
42
- # Offense count: 1
43
- # This cop supports safe autocorrection (--autocorrect).
44
- Layout/EmptyLines:
45
- Exclude:
46
- - 'lib/spree/auth/engine.rb'
47
-
48
- # Offense count: 2
49
- # This cop supports safe autocorrection (--autocorrect).
50
- # Configuration parameters: EnforcedStyleAlignWith, Severity.
51
- # SupportedStylesAlignWith: keyword, variable, start_of_line
52
- Layout/EndAlignment:
53
- Exclude:
54
- - 'config/initializers/devise.rb'
55
- - 'spec/support/features/fill_addresses_fields.rb'
56
-
57
- # Offense count: 4
58
- # This cop supports safe autocorrection (--autocorrect).
59
- # Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
60
- Layout/IndentationWidth:
61
- Exclude:
62
- - 'config/initializers/devise.rb'
63
- - 'spec/features/admin/sign_out_spec.rb'
64
- - 'spec/features/sign_out_spec.rb'
65
- - 'spec/support/features/fill_addresses_fields.rb'
66
-
67
- # Offense count: 4
68
- # This cop supports safe autocorrection (--autocorrect).
69
- # Configuration parameters: EnforcedStyle.
70
- # SupportedStyles: symmetrical, new_line, same_line
71
- Layout/MultilineMethodCallBraceLayout:
72
- Exclude:
73
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
74
- - 'spec/controllers/spree/user_sessions_controller_spec.rb'
75
- - 'spec/features/admin/password_reset_spec.rb'
76
-
77
- # Offense count: 1
78
- # This cop supports safe autocorrection (--autocorrect).
79
- Layout/SpaceAfterComma:
80
- Exclude:
81
- - 'spec/features/account_spec.rb'
82
-
83
- # Offense count: 1
84
- # This cop supports safe autocorrection (--autocorrect).
85
- Layout/SpaceBeforeComma:
86
- Exclude:
87
- - 'spec/features/account_spec.rb'
88
-
89
- # Offense count: 1
90
- # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
91
- Lint/AmbiguousBlockAssociation:
92
- Exclude:
93
- - 'spec/controllers/spree/checkout_controller_spec.rb'
94
-
95
- # Offense count: 3
96
- # This cop supports safe autocorrection (--autocorrect).
97
- RSpec/BeEql:
98
- Exclude:
99
- - 'spec/models/user_spec.rb'
100
-
101
- # Offense count: 1
102
- RSpec/BeforeAfterAll:
103
- Exclude:
104
- - 'spec/models/user_spec.rb'
105
-
106
- # Offense count: 5
107
- # This cop supports safe autocorrection (--autocorrect).
108
- Capybara/CurrentPathExpectation:
109
- Exclude:
110
- - 'spec/features/admin/sign_in_spec.rb'
111
- - 'spec/features/sign_in_spec.rb'
112
-
113
- # Offense count: 69
114
- # This cop supports safe autocorrection (--autocorrect).
115
- # Configuration parameters: EnabledMethods.
116
- RSpec/Capybara/FeatureMethods:
117
- Exclude:
118
- - 'spec/features/account_spec.rb'
119
- - 'spec/features/admin/password_reset_spec.rb'
120
- - 'spec/features/admin/products_spec.rb'
121
- - 'spec/features/admin/sign_in_spec.rb'
122
- - 'spec/features/admin/sign_out_spec.rb'
123
- - 'spec/features/admin_permissions_spec.rb'
124
- - 'spec/features/change_email_spec.rb'
125
- - 'spec/features/checkout_spec.rb'
126
- - 'spec/features/confirmation_spec.rb'
127
- - 'spec/features/order_spec.rb'
128
- - 'spec/features/password_reset_spec.rb'
129
- - 'spec/features/sign_in_spec.rb'
130
- - 'spec/features/sign_out_spec.rb'
131
- - 'spec/features/sign_up_spec.rb'
132
- - 'spec/requests/spree/frontend/user_update_spec.rb'
133
-
134
- # Offense count: 12
135
- # This cop supports safe autocorrection (--autocorrect).
136
- RSpec/ContextMethod:
137
- Exclude:
138
- - 'spec/controllers/spree/checkout_controller_spec.rb'
139
- - 'spec/controllers/spree/user_passwords_controller_spec.rb'
140
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
141
- - 'spec/controllers/spree/user_sessions_controller_spec.rb'
142
- - 'spec/controllers/spree/users_controller_spec.rb'
143
- - 'spec/models/order_spec.rb'
144
-
145
- # Offense count: 26
146
- # Configuration parameters: Prefixes.
147
- # Prefixes: when, with, without
148
- RSpec/ContextWording:
149
- Exclude:
150
- - 'spec/controllers/spree/checkout_controller_spec.rb'
151
- - 'spec/controllers/spree/user_passwords_controller_spec.rb'
152
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
153
- - 'spec/controllers/spree/user_sessions_controller_spec.rb'
154
- - 'spec/controllers/spree/users_controller_spec.rb'
155
- - 'spec/features/account_spec.rb'
156
- - 'spec/features/admin/password_reset_spec.rb'
157
- - 'spec/features/admin/products_spec.rb'
158
- - 'spec/features/admin_permissions_spec.rb'
159
- - 'spec/mailers/user_mailer_spec.rb'
160
- - 'spec/models/order_spec.rb'
161
- - 'spec/models/user_spec.rb'
162
- - 'spec/requests/spree/frontend/user_update_spec.rb'
163
-
164
- # Offense count: 6
165
- # This cop supports unsafe autocorrection (--autocorrect-all).
166
- # Configuration parameters: SkipBlocks, EnforcedStyle.
167
- # SupportedStyles: described_class, explicit
168
- RSpec/DescribedClass:
169
- Exclude:
170
- - 'spec/mailers/user_mailer_spec.rb'
171
- - 'spec/models/user_spec.rb'
172
-
173
- # Offense count: 2
174
- # This cop supports safe autocorrection (--autocorrect).
175
- RSpec/EmptyLineAfterFinalLet:
176
- Exclude:
177
- - 'spec/controllers/spree/user_sessions_controller_spec.rb'
178
- - 'spec/models/order_spec.rb'
179
-
180
- # Offense count: 1
181
- # This cop supports safe autocorrection (--autocorrect).
182
- RSpec/EmptyLineAfterSubject:
183
- Exclude:
184
- - 'spec/controllers/spree/checkout_controller_spec.rb'
185
-
186
- # Offense count: 1
187
- # This cop supports safe autocorrection (--autocorrect).
188
- # Configuration parameters: CustomTransform, IgnoredWords.
189
- RSpec/ExampleWording:
190
- Exclude:
191
- - 'spec/features/sign_in_spec.rb'
192
-
193
- # Offense count: 1
194
- # This cop supports safe autocorrection (--autocorrect).
195
- RSpec/ExpectActual:
196
- Exclude:
197
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
198
-
199
- # Offense count: 2
200
- # This cop supports unsafe autocorrection (--autocorrect-all).
201
- # Configuration parameters: EnforcedStyle.
202
- # SupportedStyles: method_call, block
203
- RSpec/ExpectChange:
204
- Exclude:
205
- - 'spec/controllers/spree/checkout_controller_spec.rb'
206
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
207
-
208
- # Offense count: 3
209
- # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
210
- # Include: **/*_spec*rb*, **/spec/**/*
211
- RSpec/FilePath:
212
- Exclude:
213
- - 'spec/mailers/user_mailer_spec.rb'
214
- - 'spec/models/order_spec.rb'
215
- - 'spec/models/user_spec.rb'
216
-
217
- # Offense count: 15
218
- # Configuration parameters: AssignmentOnly.
219
- RSpec/InstanceVariable:
220
- Exclude:
221
- - 'spec/controllers/spree/admin/user_passwords_controller_spec.rb'
222
- - 'spec/controllers/spree/user_passwords_controller_spec.rb'
223
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
224
- - 'spec/features/admin/sign_in_spec.rb'
225
- - 'spec/features/checkout_spec.rb'
226
- - 'spec/features/sign_in_spec.rb'
227
- - 'spec/mailers/user_mailer_spec.rb'
228
-
229
- # Offense count: 2
230
- # This cop supports safe autocorrection (--autocorrect).
231
- RSpec/LeadingSubject:
232
- Exclude:
233
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
234
- - 'spec/controllers/spree/user_sessions_controller_spec.rb'
235
-
236
- # Offense count: 5
237
- RSpec/LetSetup:
238
- Exclude:
239
- - 'spec/features/admin/password_reset_spec.rb'
240
- - 'spec/features/confirmation_spec.rb'
241
- - 'spec/features/password_reset_spec.rb'
242
-
243
- # Offense count: 6
244
- # Configuration parameters: .
245
- # SupportedStyles: have_received, receive
246
- RSpec/MessageSpies:
247
- EnforcedStyle: receive
248
-
249
- # Offense count: 39
250
- RSpec/MultipleExpectations:
251
- Max: 5
252
-
253
- # Offense count: 26
254
- # Configuration parameters: IgnoreSharedExamples.
255
- RSpec/NamedSubject:
256
- Exclude:
257
- - 'spec/controllers/spree/checkout_controller_spec.rb'
258
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
259
- - 'spec/controllers/spree/user_sessions_controller_spec.rb'
260
- - 'spec/controllers/spree/users_controller_spec.rb'
261
-
262
- # Offense count: 30
263
- RSpec/NestedGroups:
264
- Max: 5
265
-
266
- # Offense count: 3
267
- # This cop supports safe autocorrection (--autocorrect).
268
- # Configuration parameters: EnforcedStyle.
269
- # SupportedStyles: not_to, to_not
270
- RSpec/NotToNot:
271
- Exclude:
272
- - 'spec/controllers/spree/users_controller_spec.rb'
273
- - 'spec/features/admin/password_reset_spec.rb'
274
- - 'spec/features/password_reset_spec.rb'
275
-
276
- # Offense count: 2
277
- RSpec/RepeatedExampleGroupDescription:
278
- Exclude:
279
- - 'spec/models/user_spec.rb'
280
-
281
- # Offense count: 7
282
- # This cop supports safe autocorrection (--autocorrect).
283
- # Configuration parameters: EnforcedStyle.
284
- # SupportedStyles: and_return, block
285
- RSpec/ReturnFromStub:
286
- Exclude:
287
- - 'spec/controllers/spree/checkout_controller_spec.rb'
288
- - 'spec/controllers/spree/products_controller_spec.rb'
289
- - 'spec/models/order_spec.rb'
290
-
291
- # Offense count: 1
292
- RSpec/StubbedMock:
293
- Exclude:
294
- - 'spec/models/user_spec.rb'
295
-
296
- # Offense count: 2
297
- # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
298
- RSpec/VerifiedDoubles:
299
- Exclude:
300
- - 'spec/features/confirmation_spec.rb'
301
- - 'spec/models/user_spec.rb'
302
-
303
- # Offense count: 12
304
- # This cop supports unsafe autocorrection (--autocorrect-all).
305
- # Configuration parameters: Include.
306
- # Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
307
- Rails/Output:
308
- Exclude:
309
- - 'db/default/users.rb'
310
-
311
- # Offense count: 8
312
- # This cop supports unsafe autocorrection (--autocorrect-all).
313
- # Configuration parameters: EnforcedStyle.
314
- # SupportedStyles: nested, compact
315
- Style/ClassAndModuleChildren:
316
- Exclude:
317
- - 'lib/controllers/backend/spree/admin/user_passwords_controller.rb'
318
- - 'lib/controllers/backend/spree/admin/user_sessions_controller.rb'
319
- - 'lib/controllers/frontend/spree/user_confirmations_controller.rb'
320
- - 'lib/controllers/frontend/spree/user_passwords_controller.rb'
321
- - 'lib/controllers/frontend/spree/user_registrations_controller.rb'
322
- - 'lib/controllers/frontend/spree/user_sessions_controller.rb'
323
- - 'lib/controllers/frontend/spree/users_controller.rb'
324
- - 'lib/decorators/backend/controllers/spree/admin/orders/customer_details_controller_decorator.rb'
325
-
326
- # Offense count: 1
327
- # This cop supports safe autocorrection (--autocorrect).
328
- # Configuration parameters: EnforcedStyle.
329
- # SupportedStyles: compact, expanded
330
- Style/EmptyMethod:
331
- Exclude:
332
- - 'lib/controllers/backend/spree/admin/user_sessions_controller.rb'
333
-
334
- # Offense count: 1
335
- # This cop supports safe autocorrection (--autocorrect).
336
- Style/ExpandPathArguments:
337
- Exclude:
338
- - 'spec/support/confirm_helpers.rb'
339
-
340
- # Offense count: 3
341
- # This cop supports unsafe autocorrection (--autocorrect-all).
342
- Style/GlobalStdStream:
343
- Exclude:
344
- - 'db/default/users.rb'
345
-
346
- # Offense count: 6
347
- # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
348
- Style/GuardClause:
349
- Exclude:
350
- - 'db/migrate/20101026184949_create_users.rb'
351
- - 'db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb'
352
- - 'db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb'
353
- - 'db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb'
354
- - 'lib/spree/authentication_helpers.rb'
355
-
356
- # Offense count: 1
357
- # This cop supports safe autocorrection (--autocorrect).
358
- Style/RedundantFileExtensionInRequire:
359
- Exclude:
360
- - 'db/seeds.rb'
361
-
362
- # Offense count: 1
363
- # This cop supports safe autocorrection (--autocorrect).
364
- # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
365
- # SupportedStyles: slashes, percent_r, mixed
366
- Style/RegexpLiteral:
367
- Exclude:
368
- - 'spec/features/checkout_spec.rb'
369
-
370
- # Offense count: 1
371
- # This cop supports safe autocorrection (--autocorrect).
372
- # Configuration parameters: EnforcedStyle.
373
- # SupportedStyles: implicit, explicit
374
- Style/RescueStandardError:
375
- Exclude:
376
- - 'spec/requests/spree/frontend/user_update_spec.rb'
377
-
378
- # Offense count: 1
379
- # This cop supports safe autocorrection (--autocorrect).
380
- # Configuration parameters: AllowModifier.
381
- Style/SoleNestedConditional:
382
- Exclude:
383
- - 'config/initializers/warden.rb'
384
-
385
- # Offense count: 1
386
- # This cop supports unsafe autocorrection (--autocorrect-all).
387
- # Configuration parameters: Mode.
388
- Style/StringConcatenation:
389
- Exclude:
390
- - 'app/models/spree/user.rb'
391
-
392
- # Offense count: 6
393
- # This cop supports safe autocorrection (--autocorrect).
394
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
395
- # URISchemes: http, https
396
- Layout/LineLength:
397
- Max: 227
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree::Admin::Orders::CustomerDetailsControllerDecorator
4
- def self.prepended(base)
5
- base.before_action :check_authorization
6
- end
7
-
8
- private
9
-
10
- def check_authorization
11
- load_order
12
- session[:access_token] ||= params[:token]
13
-
14
- resource = @order
15
- action = params[:action].to_sym
16
- action = :edit if action == :show # show route renders :edit for this controller
17
-
18
- authorize! action, resource, session[:access_token]
19
- end
20
-
21
- Spree::Admin::Orders::CustomerDetailsController.prepend self
22
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Devise.secret_key = SecureRandom.hex(50).inspect
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module AuthenticationHelpers
5
- def self.included(receiver)
6
- if receiver.send(:respond_to?, :helper_method)
7
- receiver.send(:helper_method, :spree_current_user)
8
-
9
- if SolidusSupport.frontend_available?
10
- receiver.send(:helper_method, :spree_login_path)
11
- receiver.send(:helper_method, :spree_signup_path)
12
- receiver.send(:helper_method, :spree_logout_path)
13
- end
14
- end
15
- end
16
-
17
- def spree_current_user
18
- current_spree_user
19
- end
20
-
21
- if SolidusSupport.frontend_available?
22
- delegate :login_path, :signup_path, :logout_path,
23
- to: :spree,
24
- prefix: :spree
25
- end
26
- end
27
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Spree::Admin::BaseController, type: :controller do
6
- describe '#unauthorized_redirect' do
7
- controller(described_class) do
8
- def index; authorize!(:read, :something); end
9
- end
10
-
11
- before do
12
- stub_spree_preferences(Spree::Config, redirect_back_on_unauthorized: true)
13
- end
14
-
15
- context "when user is logged in" do
16
- before { sign_in(create(:user)) }
17
-
18
- context "when http_referrer is not present" do
19
- it "redirects to unauthorized path" do
20
- get :index
21
- expect(response).to redirect_to(spree.admin_unauthorized_path)
22
- end
23
- end
24
-
25
- context "when http_referrer is present" do
26
- before { request.env['HTTP_REFERER'] = '/redirect' }
27
-
28
- it "redirects back" do
29
- get :index
30
- expect(response).to redirect_to('/redirect')
31
- end
32
- end
33
- end
34
-
35
- context "when user is not logged in" do
36
- context "when http_referrer is not present" do
37
- it "redirects to login path" do
38
- get :index
39
- expect(response).to redirect_to(spree.admin_login_path)
40
- end
41
- end
42
-
43
- context "when http_referrer is present" do
44
- before { request.env['HTTP_REFERER'] = '/redirect' }
45
-
46
- it "redirects back" do
47
- get :index
48
- expect(response).to redirect_to('/redirect')
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe Spree::Admin::UserPasswordsController, type: :controller do
4
- before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }
5
-
6
- describe '#create' do
7
- it 'responds with success' do
8
- post :create, params: { spree_user: { email: 'admin@example.com' } }
9
-
10
- expect(assigns[:spree_user].email).to eq('admin@example.com')
11
- expect(response.code).to eq('200')
12
- end
13
- end
14
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe Spree::Admin::UserSessionsController, type: :controller do
4
- let(:user) { create(:user, password: 'secret') }
5
-
6
- before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] } # rubocop:disable RSpec/InstanceVariable
7
-
8
- it "redirects to the admin root after signing in with no stored location" do
9
- get :new
10
-
11
- post(:create, params: {
12
- spree_user: {
13
- email: user.email,
14
- password: 'secret'
15
- },
16
- })
17
-
18
- expect(response).to redirect_to spree.admin_path
19
- end
20
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Spree::BaseController, type: :controller do
6
- describe '#unauthorized_redirect' do
7
- controller(described_class) do
8
- def index; authorize!(:read, :something); end
9
- end
10
-
11
- before do
12
- stub_spree_preferences(Spree::Config, redirect_back_on_unauthorized: true)
13
- end
14
-
15
- context "when user is logged in" do
16
- before { sign_in(create(:user)) }
17
-
18
- context "when http_referrer is not present" do
19
- it "redirects to unauthorized path" do
20
- get :index
21
- expect(response).to redirect_to(spree.unauthorized_path)
22
- end
23
- end
24
-
25
- context "when http_referrer is present" do
26
- before { request.env['HTTP_REFERER'] = '/redirect' }
27
-
28
- it "redirects back" do
29
- get :index
30
- expect(response).to redirect_to('/redirect')
31
- end
32
- end
33
- end
34
-
35
- context "when user is not logged in" do
36
- context "when http_referrer is not present" do
37
- it "redirects to login path" do
38
- get :index
39
- expect(response).to redirect_to(spree.login_path)
40
- end
41
- end
42
-
43
- context "when http_referrer is present" do
44
- before { request.env['HTTP_REFERER'] = '/redirect' }
45
-
46
- it "redirects back" do
47
- get :index
48
- expect(response).to redirect_to('/redirect')
49
- end
50
- end
51
- end
52
- end
53
- end