devise_masquerade 1.3.7 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/devise/masquerades_controller.rb +32 -21
- data/lib/devise_masquerade/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f3c384ee31658834131c95ec34bc376340a9f7d8b7d237ed97316f6e61eb5ee
|
4
|
+
data.tar.gz: 78f66fc23c43a3db4eef66c98e15447decfea5627b2900c2ee827785a3b0cdd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6b318f8d335a53524a94d24b5c1bc78c41bc308200a0eed543fabdfb891e63a1d119efee269282f9f2e4e1d1a7dd27161076ed9465c3ac55b188f2127dce429
|
7
|
+
data.tar.gz: 0d39bbd0099a4d70496ece49d3db3e955eadbcb14bc20accfcc9fcc90c070b9e7aa5b697ce91367c7d20590a218d182fe99b7d0c37b220fd4bbb59ee1f6c5bde
|
data/Gemfile.lock
CHANGED
@@ -10,41 +10,52 @@ class Devise::MasqueradesController < DeviseController
|
|
10
10
|
prepend_before_action :masquerade_authorize!
|
11
11
|
|
12
12
|
def show
|
13
|
-
|
13
|
+
if send("#{masqueraded_resource_name}_masquerade?")
|
14
|
+
resource = send("current_#{masquerading_resource_name}")
|
14
15
|
|
15
|
-
|
16
|
+
go_back(resource, path: after_masquerade_full_path_for(resource))
|
17
|
+
else
|
18
|
+
masqueradable_resource = find_masqueradable_resource
|
16
19
|
|
17
|
-
|
18
|
-
sign_out(send("current_#{masquerading_resource_name}"))
|
20
|
+
save_masquerade_owner_session(masqueradable_resource)
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
redirect_to(new_user_session_path) and return
|
23
|
-
end
|
22
|
+
resource = masqueradable_resource
|
23
|
+
sign_out(send("current_#{masquerading_resource_name}"))
|
24
24
|
|
25
|
-
|
25
|
+
unless resource
|
26
|
+
flash[:error] = "#{masqueraded_resource_class} not found."
|
27
|
+
redirect_to(new_user_session_path) and return
|
28
|
+
end
|
26
29
|
|
27
|
-
|
30
|
+
request.env['devise.skip_trackable'] = '1'
|
28
31
|
|
29
|
-
|
32
|
+
masquerade_sign_in(resource)
|
33
|
+
|
34
|
+
go_back(resource, path: after_masquerade_full_path_for(resource))
|
35
|
+
end
|
30
36
|
end
|
31
37
|
|
32
38
|
def back
|
33
|
-
|
39
|
+
unless send("#{masqueraded_resource_name}_masquerade?")
|
40
|
+
resource = send("current_#{masqueraded_resource_name}")
|
41
|
+
go_back(resource, path: after_back_masquerade_path_for(resource))
|
42
|
+
else
|
43
|
+
masqueradable_resource = send("current_#{masqueraded_resource_name}")
|
34
44
|
|
35
|
-
|
36
|
-
|
37
|
-
|
45
|
+
unless send("#{masqueraded_resource_name}_signed_in?")
|
46
|
+
head(401) and return
|
47
|
+
end
|
38
48
|
|
39
|
-
|
40
|
-
|
49
|
+
resource = find_owner_resource(masqueradable_resource)
|
50
|
+
sign_out(send("current_#{masqueraded_resource_name}"))
|
41
51
|
|
42
|
-
|
43
|
-
|
52
|
+
sign_in(resource)
|
53
|
+
request.env['devise.skip_trackable'] = nil
|
44
54
|
|
45
|
-
|
55
|
+
go_back(resource, path: after_back_masquerade_path_for(resource))
|
46
56
|
|
47
|
-
|
57
|
+
cleanup_masquerade_owner_session(masqueradable_resource)
|
58
|
+
end
|
48
59
|
end
|
49
60
|
|
50
61
|
protected
|