solidus_auth_devise 2.5.8 → 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 (88) 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 +2 -2
  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/bin/sandbox +2 -2
  12. data/config/initializers/devise.rb +7 -5
  13. data/config/initializers/warden.rb +1 -1
  14. data/config/routes.rb +31 -31
  15. data/db/default/users.rb +5 -5
  16. data/db/migrate/20101026184949_create_users.rb +19 -19
  17. data/db/migrate/20101026184950_rename_columns_for_devise.rb +1 -3
  18. data/db/migrate/20101214150824_convert_user_remember_field.rb +1 -1
  19. data/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb +1 -1
  20. data/db/migrate/20120605211305_make_users_email_index_unique.rb +1 -1
  21. data/db/migrate/20140904000425_add_deleted_at_to_users.rb +1 -1
  22. data/db/migrate/20141002154641_add_confirmable_to_users.rb +1 -1
  23. data/db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb +3 -3
  24. data/db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb +1 -1
  25. data/db/seeds.rb +1 -1
  26. data/lib/controllers/backend/spree/admin/user_passwords_controller.rb +3 -3
  27. data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +11 -7
  28. data/lib/controllers/frontend/spree/user_confirmations_controller.rb +1 -1
  29. data/lib/controllers/frontend/spree/user_passwords_controller.rb +2 -2
  30. data/lib/controllers/frontend/spree/user_registrations_controller.rb +2 -2
  31. data/lib/controllers/frontend/spree/user_sessions_controller.rb +6 -6
  32. data/lib/controllers/frontend/spree/users_controller.rb +6 -3
  33. data/lib/generators/solidus/auth/install/install_generator.rb +7 -7
  34. data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb.erb +4 -0
  35. data/lib/generators/solidus_auth_devise/install/install_generator.rb +2 -2
  36. data/lib/{decorators/backend/controllers/spree/admin/base_controller_decorator.rb → patches/backend/controllers/solidus_auth_devise/admin/base_controller_patch.rb} +2 -2
  37. data/lib/patches/backend/controllers/solidus_auth_devise/admin/orders/customer_details_controller_patch.rb +28 -0
  38. data/lib/{decorators/frontend/controllers/spree/checkout_controller_decorator.rb → patches/frontend/controllers/solidus_auth_devise/checkout_controller_patch.rb} +7 -7
  39. data/lib/solidus_auth_devise/configuration.rb +1 -1
  40. data/lib/solidus_auth_devise/engine.rb +1 -1
  41. data/lib/solidus_auth_devise/version.rb +1 -1
  42. data/lib/solidus_auth_devise.rb +9 -11
  43. data/lib/spree/auth/engine.rb +10 -15
  44. data/lib/spree/auth/version.rb +1 -1
  45. data/lib/tasks/auth.rake +1 -1
  46. data/solidus_auth_devise.gemspec +20 -21
  47. metadata +19 -94
  48. data/.circleci/config.yml +0 -73
  49. data/.rubocop_todo.yml +0 -398
  50. data/lib/decorators/backend/controllers/spree/admin/orders/customer_details_controller_decorator.rb +0 -22
  51. data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb +0 -3
  52. data/lib/spree/authentication_helpers.rb +0 -27
  53. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -53
  54. data/spec/controllers/spree/admin/user_passwords_controller_spec.rb +0 -14
  55. data/spec/controllers/spree/base_controller_spec.rb +0 -53
  56. data/spec/controllers/spree/checkout_controller_spec.rb +0 -192
  57. data/spec/controllers/spree/products_controller_spec.rb +0 -24
  58. data/spec/controllers/spree/user_passwords_controller_spec.rb +0 -45
  59. data/spec/controllers/spree/user_registrations_controller_spec.rb +0 -97
  60. data/spec/controllers/spree/user_sessions_controller_spec.rb +0 -127
  61. data/spec/controllers/spree/users_controller_spec.rb +0 -79
  62. data/spec/factories/confirmed_user.rb +0 -9
  63. data/spec/features/account_spec.rb +0 -59
  64. data/spec/features/admin/password_reset_spec.rb +0 -80
  65. data/spec/features/admin/products_spec.rb +0 -10
  66. data/spec/features/admin/sign_in_spec.rb +0 -45
  67. data/spec/features/admin/sign_out_spec.rb +0 -23
  68. data/spec/features/admin_permissions_spec.rb +0 -47
  69. data/spec/features/change_email_spec.rb +0 -27
  70. data/spec/features/checkout_spec.rb +0 -158
  71. data/spec/features/confirmation_spec.rb +0 -28
  72. data/spec/features/order_spec.rb +0 -59
  73. data/spec/features/password_reset_spec.rb +0 -37
  74. data/spec/features/sign_in_spec.rb +0 -53
  75. data/spec/features/sign_out_spec.rb +0 -26
  76. data/spec/features/sign_up_spec.rb +0 -31
  77. data/spec/mailers/user_mailer_spec.rb +0 -47
  78. data/spec/models/order_spec.rb +0 -27
  79. data/spec/models/user_spec.rb +0 -103
  80. data/spec/requests/spree/frontend/user_update_spec.rb +0 -42
  81. data/spec/spec_helper.rb +0 -33
  82. data/spec/support/ability.rb +0 -17
  83. data/spec/support/authentication_helpers.rb +0 -16
  84. data/spec/support/confirm_helpers.rb +0 -27
  85. data/spec/support/email.rb +0 -7
  86. data/spec/support/features/fill_addresses_fields.rb +0 -29
  87. data/spec/support/preferences.rb +0 -13
  88. data/spec/support/spree.rb +0 -11
data/.rubocop_todo.yml DELETED
@@ -1,398 +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
- RSpec/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/controllers/spree/user_sessions_controller_spec.rb'
225
- - 'spec/features/admin/sign_in_spec.rb'
226
- - 'spec/features/checkout_spec.rb'
227
- - 'spec/features/sign_in_spec.rb'
228
- - 'spec/mailers/user_mailer_spec.rb'
229
-
230
- # Offense count: 2
231
- # This cop supports safe autocorrection (--autocorrect).
232
- RSpec/LeadingSubject:
233
- Exclude:
234
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
235
- - 'spec/controllers/spree/user_sessions_controller_spec.rb'
236
-
237
- # Offense count: 5
238
- RSpec/LetSetup:
239
- Exclude:
240
- - 'spec/features/admin/password_reset_spec.rb'
241
- - 'spec/features/confirmation_spec.rb'
242
- - 'spec/features/password_reset_spec.rb'
243
-
244
- # Offense count: 6
245
- # Configuration parameters: .
246
- # SupportedStyles: have_received, receive
247
- RSpec/MessageSpies:
248
- EnforcedStyle: receive
249
-
250
- # Offense count: 39
251
- RSpec/MultipleExpectations:
252
- Max: 5
253
-
254
- # Offense count: 26
255
- # Configuration parameters: IgnoreSharedExamples.
256
- RSpec/NamedSubject:
257
- Exclude:
258
- - 'spec/controllers/spree/checkout_controller_spec.rb'
259
- - 'spec/controllers/spree/user_registrations_controller_spec.rb'
260
- - 'spec/controllers/spree/user_sessions_controller_spec.rb'
261
- - 'spec/controllers/spree/users_controller_spec.rb'
262
-
263
- # Offense count: 30
264
- RSpec/NestedGroups:
265
- Max: 5
266
-
267
- # Offense count: 3
268
- # This cop supports safe autocorrection (--autocorrect).
269
- # Configuration parameters: EnforcedStyle.
270
- # SupportedStyles: not_to, to_not
271
- RSpec/NotToNot:
272
- Exclude:
273
- - 'spec/controllers/spree/users_controller_spec.rb'
274
- - 'spec/features/admin/password_reset_spec.rb'
275
- - 'spec/features/password_reset_spec.rb'
276
-
277
- # Offense count: 2
278
- RSpec/RepeatedExampleGroupDescription:
279
- Exclude:
280
- - 'spec/models/user_spec.rb'
281
-
282
- # Offense count: 7
283
- # This cop supports safe autocorrection (--autocorrect).
284
- # Configuration parameters: EnforcedStyle.
285
- # SupportedStyles: and_return, block
286
- RSpec/ReturnFromStub:
287
- Exclude:
288
- - 'spec/controllers/spree/checkout_controller_spec.rb'
289
- - 'spec/controllers/spree/products_controller_spec.rb'
290
- - 'spec/models/order_spec.rb'
291
-
292
- # Offense count: 1
293
- RSpec/StubbedMock:
294
- Exclude:
295
- - 'spec/models/user_spec.rb'
296
-
297
- # Offense count: 2
298
- # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
299
- RSpec/VerifiedDoubles:
300
- Exclude:
301
- - 'spec/features/confirmation_spec.rb'
302
- - 'spec/models/user_spec.rb'
303
-
304
- # Offense count: 12
305
- # This cop supports unsafe autocorrection (--autocorrect-all).
306
- # Configuration parameters: Include.
307
- # Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
308
- Rails/Output:
309
- Exclude:
310
- - 'db/default/users.rb'
311
-
312
- # Offense count: 8
313
- # This cop supports unsafe autocorrection (--autocorrect-all).
314
- # Configuration parameters: EnforcedStyle.
315
- # SupportedStyles: nested, compact
316
- Style/ClassAndModuleChildren:
317
- Exclude:
318
- - 'lib/controllers/backend/spree/admin/user_passwords_controller.rb'
319
- - 'lib/controllers/backend/spree/admin/user_sessions_controller.rb'
320
- - 'lib/controllers/frontend/spree/user_confirmations_controller.rb'
321
- - 'lib/controllers/frontend/spree/user_passwords_controller.rb'
322
- - 'lib/controllers/frontend/spree/user_registrations_controller.rb'
323
- - 'lib/controllers/frontend/spree/user_sessions_controller.rb'
324
- - 'lib/controllers/frontend/spree/users_controller.rb'
325
- - 'lib/decorators/backend/controllers/spree/admin/orders/customer_details_controller_decorator.rb'
326
-
327
- # Offense count: 1
328
- # This cop supports safe autocorrection (--autocorrect).
329
- # Configuration parameters: EnforcedStyle.
330
- # SupportedStyles: compact, expanded
331
- Style/EmptyMethod:
332
- Exclude:
333
- - 'lib/controllers/backend/spree/admin/user_sessions_controller.rb'
334
-
335
- # Offense count: 1
336
- # This cop supports safe autocorrection (--autocorrect).
337
- Style/ExpandPathArguments:
338
- Exclude:
339
- - 'spec/support/confirm_helpers.rb'
340
-
341
- # Offense count: 3
342
- # This cop supports unsafe autocorrection (--autocorrect-all).
343
- Style/GlobalStdStream:
344
- Exclude:
345
- - 'db/default/users.rb'
346
-
347
- # Offense count: 6
348
- # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
349
- Style/GuardClause:
350
- Exclude:
351
- - 'db/migrate/20101026184949_create_users.rb'
352
- - 'db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb'
353
- - 'db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb'
354
- - 'db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb'
355
- - 'lib/spree/authentication_helpers.rb'
356
-
357
- # Offense count: 1
358
- # This cop supports safe autocorrection (--autocorrect).
359
- Style/RedundantFileExtensionInRequire:
360
- Exclude:
361
- - 'db/seeds.rb'
362
-
363
- # Offense count: 1
364
- # This cop supports safe autocorrection (--autocorrect).
365
- # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
366
- # SupportedStyles: slashes, percent_r, mixed
367
- Style/RegexpLiteral:
368
- Exclude:
369
- - 'spec/features/checkout_spec.rb'
370
-
371
- # Offense count: 1
372
- # This cop supports safe autocorrection (--autocorrect).
373
- # Configuration parameters: EnforcedStyle.
374
- # SupportedStyles: implicit, explicit
375
- Style/RescueStandardError:
376
- Exclude:
377
- - 'spec/requests/spree/frontend/user_update_spec.rb'
378
-
379
- # Offense count: 1
380
- # This cop supports safe autocorrection (--autocorrect).
381
- # Configuration parameters: AllowModifier.
382
- Style/SoleNestedConditional:
383
- Exclude:
384
- - 'config/initializers/warden.rb'
385
-
386
- # Offense count: 1
387
- # This cop supports unsafe autocorrection (--autocorrect-all).
388
- # Configuration parameters: Mode.
389
- Style/StringConcatenation:
390
- Exclude:
391
- - 'app/models/spree/user.rb'
392
-
393
- # Offense count: 6
394
- # This cop supports safe autocorrection (--autocorrect).
395
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
396
- # URISchemes: http, https
397
- Layout/LineLength:
398
- 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,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