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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c612609f3eeb20d48b13ed9166d5a6e3631cf284bda1aceb67501686bb806ee
4
- data.tar.gz: 7c1e2356ec14f72af05816534d037b2a1e344a5d482a28156f71053b4d1dab0e
3
+ metadata.gz: 3f3c384ee31658834131c95ec34bc376340a9f7d8b7d237ed97316f6e61eb5ee
4
+ data.tar.gz: 78f66fc23c43a3db4eef66c98e15447decfea5627b2900c2ee827785a3b0cdd2
5
5
  SHA512:
6
- metadata.gz: 7545f0259d8607d0f06738308704646fccfea3708f33b39408302afc9893ab1203d36a5f3cedebb12ab4fc9b150b198d7dbf6f984655bec3ff02aa4ab2e76c47
7
- data.tar.gz: 5e0b106db2ce2d05b1bfcbd91c81730ce09560e248bea3b700c6ba9ad822bbad68adf19305763470817b76a0b18775a974ba431334a1c043c9e1abe5345aec96
6
+ metadata.gz: a6b318f8d335a53524a94d24b5c1bc78c41bc308200a0eed543fabdfb891e63a1d119efee269282f9f2e4e1d1a7dd27161076ed9465c3ac55b188f2127dce429
7
+ data.tar.gz: 0d39bbd0099a4d70496ece49d3db3e955eadbcb14bc20accfcc9fcc90c070b9e7aa5b697ce91367c7d20590a218d182fe99b7d0c37b220fd4bbb59ee1f6c5bde
data/Gemfile.lock CHANGED
@@ -52,7 +52,7 @@ GIT
52
52
  PATH
53
53
  remote: .
54
54
  specs:
55
- devise_masquerade (1.3.7)
55
+ devise_masquerade (1.3.8)
56
56
  devise (>= 4.7.0)
57
57
  globalid (>= 0.3.6)
58
58
  railties (>= 5.2.0)
@@ -10,41 +10,52 @@ class Devise::MasqueradesController < DeviseController
10
10
  prepend_before_action :masquerade_authorize!
11
11
 
12
12
  def show
13
- masqueradable_resource = find_masqueradable_resource
13
+ if send("#{masqueraded_resource_name}_masquerade?")
14
+ resource = send("current_#{masquerading_resource_name}")
14
15
 
15
- save_masquerade_owner_session(masqueradable_resource)
16
+ go_back(resource, path: after_masquerade_full_path_for(resource))
17
+ else
18
+ masqueradable_resource = find_masqueradable_resource
16
19
 
17
- self.resource = masqueradable_resource
18
- sign_out(send("current_#{masquerading_resource_name}"))
20
+ save_masquerade_owner_session(masqueradable_resource)
19
21
 
20
- unless resource
21
- flash[:error] = "#{masqueraded_resource_class} not found."
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
- request.env['devise.skip_trackable'] = '1'
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
- masquerade_sign_in(resource)
30
+ request.env['devise.skip_trackable'] = '1'
28
31
 
29
- go_back(resource, path: after_masquerade_full_path_for(resource))
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
- masqueradable_resource = send("current_#{masqueraded_resource_name}")
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
- unless send("#{masqueraded_resource_name}_signed_in?")
36
- head(401) and return
37
- end
45
+ unless send("#{masqueraded_resource_name}_signed_in?")
46
+ head(401) and return
47
+ end
38
48
 
39
- self.resource = find_owner_resource(masqueradable_resource)
40
- sign_out(send("current_#{masqueraded_resource_name}"))
49
+ resource = find_owner_resource(masqueradable_resource)
50
+ sign_out(send("current_#{masqueraded_resource_name}"))
41
51
 
42
- masquerade_sign_in(resource)
43
- request.env['devise.skip_trackable'] = nil
52
+ sign_in(resource)
53
+ request.env['devise.skip_trackable'] = nil
44
54
 
45
- go_back(resource, path: after_back_masquerade_path_for(resource))
55
+ go_back(resource, path: after_back_masquerade_path_for(resource))
46
56
 
47
- cleanup_masquerade_owner_session(masqueradable_resource)
57
+ cleanup_masquerade_owner_session(masqueradable_resource)
58
+ end
48
59
  end
49
60
 
50
61
  protected
@@ -1,3 +1,3 @@
1
1
  module DeviseMasquerade
2
- VERSION = '1.3.7'.freeze
2
+ VERSION = '1.3.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_masquerade
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandr Korsak