solidus_auth_devise 2.5.5 → 2.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +6 -1
- data/lib/controllers/frontend/spree/user_sessions_controller.rb +6 -1
- data/lib/controllers/frontend/spree/users_controller.rb +1 -1
- data/lib/decorators/frontend/controllers/spree/checkout_controller_decorator.rb +1 -0
- data/lib/solidus_auth_devise/version.rb +1 -1
- data/lib/spree/auth/engine.rb +3 -0
- data/lib/spree/authentication_helpers.rb +0 -25
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7714facb5fe5f4230194a4680c5f63a5f3257726811ec9a2ac337f96b20b297a
|
4
|
+
data.tar.gz: fac0bd47a9a25e211bf56135a334e5f1e3b9525513f290b0b18016e8d5409446
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb4378a3029e4db8ba943cdb5a4a54fe5b2303a8d2dfe07d8cc7e4b16609987aa9927b5a84b47844cf5122652899a77293a25440f49f42bb65d1b38711d063e8
|
7
|
+
data.tar.gz: 0332cdb250463314283e1ee3da8c3ed2ce697d0851d6c3aef946183d53c647f1d533a3f8793567fe43d15d07451890104142faaeb9b5ce74e651a7dc5f83dafb
|
@@ -17,7 +17,7 @@ class Spree::Admin::UserSessionsController < Devise::SessionsController
|
|
17
17
|
respond_to do |format|
|
18
18
|
format.html {
|
19
19
|
flash[:success] = I18n.t('spree.logged_in_succesfully')
|
20
|
-
|
20
|
+
redirect_back_or_default(after_sign_in_path_for(spree_current_user))
|
21
21
|
}
|
22
22
|
format.js {
|
23
23
|
user = resource.record
|
@@ -47,4 +47,9 @@ class Spree::Admin::UserSessionsController < Devise::SessionsController
|
|
47
47
|
def accurate_title
|
48
48
|
I18n.t('spree.login')
|
49
49
|
end
|
50
|
+
|
51
|
+
def redirect_back_or_default(default)
|
52
|
+
redirect_to(session["spree_user_return_to"] || default)
|
53
|
+
session["spree_user_return_to"] = nil
|
54
|
+
end
|
50
55
|
end
|
@@ -19,7 +19,7 @@ class Spree::UserSessionsController < Devise::SessionsController
|
|
19
19
|
respond_to do |format|
|
20
20
|
format.html do
|
21
21
|
flash[:success] = I18n.t('spree.logged_in_succesfully')
|
22
|
-
|
22
|
+
redirect_back_or_default(after_sign_in_path_for(spree_current_user))
|
23
23
|
end
|
24
24
|
format.js { render success_json }
|
25
25
|
end
|
@@ -49,6 +49,11 @@ class Spree::UserSessionsController < Devise::SessionsController
|
|
49
49
|
I18n.t('spree.login')
|
50
50
|
end
|
51
51
|
|
52
|
+
def redirect_back_or_default(default)
|
53
|
+
redirect_to(session["spree_user_return_to"] || default)
|
54
|
+
session["spree_user_return_to"] = nil
|
55
|
+
end
|
56
|
+
|
52
57
|
def success_json
|
53
58
|
{
|
54
59
|
json: {
|
data/lib/spree/auth/engine.rb
CHANGED
@@ -59,6 +59,7 @@ module Spree
|
|
59
59
|
redirect_to spree.admin_unauthorized_path
|
60
60
|
end
|
61
61
|
else
|
62
|
+
store_location
|
62
63
|
|
63
64
|
if Spree::Auth::Engine.redirect_back_on_unauthorized?
|
64
65
|
redirect_back(fallback_location: spree.admin_login_path)
|
@@ -69,6 +70,7 @@ module Spree
|
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
73
|
+
|
72
74
|
def self.prepare_frontend
|
73
75
|
Spree::BaseController.unauthorized_redirect = -> do
|
74
76
|
if spree_current_user
|
@@ -80,6 +82,7 @@ module Spree
|
|
80
82
|
redirect_to spree.unauthorized_path
|
81
83
|
end
|
82
84
|
else
|
85
|
+
store_location
|
83
86
|
|
84
87
|
if Spree::Auth::Engine.redirect_back_on_unauthorized?
|
85
88
|
redirect_back(fallback_location: spree.login_path)
|
@@ -23,30 +23,5 @@ module Spree
|
|
23
23
|
to: :spree,
|
24
24
|
prefix: :spree
|
25
25
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def authenticate_spree_user!
|
30
|
-
store_spree_user_location! if storable_spree_user_location?
|
31
|
-
|
32
|
-
super
|
33
|
-
end
|
34
|
-
|
35
|
-
# It's important that the location is NOT stored if:
|
36
|
-
# - The request method is not GET (non idempotent)
|
37
|
-
# - The request is handled by a Devise controller such as Devise::SessionsController as that could cause an
|
38
|
-
# infinite redirect loop.
|
39
|
-
# - The request is an Ajax request as this can lead to very unexpected behaviour.
|
40
|
-
def storable_spree_user_location?
|
41
|
-
request.get? && is_navigational_format? && !devise_controller? && !request.xhr?
|
42
|
-
end
|
43
|
-
|
44
|
-
def store_spree_user_location!
|
45
|
-
store_location_for(:spree_current_user, request.fullpath)
|
46
|
-
end
|
47
|
-
|
48
|
-
def stored_spree_user_location_or(fallback_location)
|
49
|
-
stored_location_for(:spree_current_user) || fallback_location
|
50
|
-
end
|
51
26
|
end
|
52
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_auth_devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
|
-
description:
|
145
|
+
description:
|
146
146
|
email: contact@solidus.io
|
147
147
|
executables: []
|
148
148
|
extensions: []
|
@@ -283,7 +283,7 @@ metadata:
|
|
283
283
|
homepage_uri: https://github.com/solidusio/solidus_auth_devise
|
284
284
|
source_code_uri: https://github.com/solidusio/solidus_auth_devise
|
285
285
|
changelog_uri: https://github.com/solidusio/solidus_auth_devise/blob/master/CHANGELOG.md
|
286
|
-
post_install_message:
|
286
|
+
post_install_message:
|
287
287
|
rdoc_options: []
|
288
288
|
require_paths:
|
289
289
|
- lib
|
@@ -301,8 +301,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: '0'
|
303
303
|
requirements: []
|
304
|
-
rubygems_version: 3.
|
305
|
-
signing_key:
|
304
|
+
rubygems_version: 3.2.32
|
305
|
+
signing_key:
|
306
306
|
specification_version: 4
|
307
307
|
summary: Provides authentication and authorization services for use with Solidus by
|
308
308
|
using Devise and CanCan.
|