devise_castle 1.3.2 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/devise_castle/passwords_controller.rb +25 -13
- data/app/controllers/devise_castle/registrations_controller.rb +28 -16
- data/lib/devise_castle/hooks.rb +26 -11
- data/lib/devise_castle/version.rb +1 -1
- data/lib/devise_castle.rb +2 -0
- data/lib/generators/devise_castle/install_generator.rb +4 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2f22f6ada2c44ff3db71806b63389b1ab3effbd
|
4
|
+
data.tar.gz: 9a7908fc9fd6f1dd802a8d190b798924a6fc731a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e164170c07efabe7eddd0f26dfc753c598ee3fd6a61af621d031edf3ee338aa7d3b7cae6ca2e3315856de5a651c64775ec04f6a5f38ab1ffc65794a6ad2e6552
|
7
|
+
data.tar.gz: 0877d062f9ed3a9025b940118bfbb9998aa147b0c0c2d31b0b831759c7abe43e9cfa6695e80ca3942b8c2f1fee78fd67864d9ef03712be6835cec65bf78c39a5
|
@@ -11,11 +11,17 @@ class DeviseCastle::PasswordsController < Devise::PasswordsController
|
|
11
11
|
super do |resource|
|
12
12
|
return if resource.respond_to?(:castle_do_not_track?) && resource.castle_do_not_track?
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
begin
|
15
|
+
castle.track(
|
16
|
+
name: '$password_reset.requested',
|
17
|
+
details: {
|
18
|
+
'$login' => username
|
19
|
+
})
|
20
|
+
rescue ::Castle::Error => e
|
21
|
+
if Devise.castle_error_handler.is_a?(Proc)
|
22
|
+
Devise.castle_error_handler.call(e)
|
23
|
+
end
|
24
|
+
end
|
19
25
|
end
|
20
26
|
end
|
21
27
|
|
@@ -23,14 +29,20 @@ class DeviseCastle::PasswordsController < Devise::PasswordsController
|
|
23
29
|
super do |resource|
|
24
30
|
return if resource.respond_to?(:castle_do_not_track?) && resource.castle_do_not_track?
|
25
31
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
begin
|
33
|
+
if resource.errors.empty?
|
34
|
+
castle.track(
|
35
|
+
name: '$password_reset.succeeded',
|
36
|
+
user_id: resource._castle_id)
|
37
|
+
else
|
38
|
+
castle.track(
|
39
|
+
name: '$password_reset.failed',
|
40
|
+
user_id: resource._castle_id)
|
41
|
+
end
|
42
|
+
rescue ::Castle::Error => e
|
43
|
+
if Devise.castle_error_handler.is_a?(Proc)
|
44
|
+
Devise.castle_error_handler.call(e)
|
45
|
+
end
|
34
46
|
end
|
35
47
|
end
|
36
48
|
end
|
@@ -3,13 +3,19 @@ class DeviseCastle::RegistrationsController < Devise::RegistrationsController
|
|
3
3
|
|
4
4
|
def create
|
5
5
|
super do |resource|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
begin
|
7
|
+
if resource.persisted?
|
8
|
+
castle.track(
|
9
|
+
name: '$registration.succeeded',
|
10
|
+
user_id: resource._castle_id)
|
11
|
+
else
|
12
|
+
castle.track(
|
13
|
+
name: '$registration.failed')
|
14
|
+
end
|
15
|
+
rescue ::Castle::Error => e
|
16
|
+
if Devise.castle_error_handler.is_a?(Proc)
|
17
|
+
Devise.castle_error_handler.call(e)
|
18
|
+
end
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
@@ -17,15 +23,21 @@ class DeviseCastle::RegistrationsController < Devise::RegistrationsController
|
|
17
23
|
def update_resource(resource, params)
|
18
24
|
resource_updated = super
|
19
25
|
|
20
|
-
|
21
|
-
if
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
begin
|
27
|
+
if params['password'].present?
|
28
|
+
if resource_updated
|
29
|
+
castle.track(
|
30
|
+
name: '$password_change.succeeded',
|
31
|
+
user_id: resource._castle_id)
|
32
|
+
else
|
33
|
+
castle.track(
|
34
|
+
name: '$password_change.failed',
|
35
|
+
user_id: resource._castle_id)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
rescue ::Castle::Error => e
|
39
|
+
if Devise.castle_error_handler.is_a?(Proc)
|
40
|
+
Devise.castle_error_handler.call(e)
|
29
41
|
end
|
30
42
|
end
|
31
43
|
|
data/lib/devise_castle/hooks.rb
CHANGED
@@ -9,7 +9,13 @@ Warden::Manager.before_logout do |record, warden, opts|
|
|
9
9
|
if record.respond_to?(:castle_id)
|
10
10
|
unless record.respond_to?(:castle_do_not_track?) && record.castle_do_not_track?
|
11
11
|
castle = warden.request.env['castle']
|
12
|
-
|
12
|
+
begin
|
13
|
+
castle.track(user_id: record._castle_id, name: '$logout.succeeded')
|
14
|
+
rescue ::Castle::Error => e
|
15
|
+
if Devise.castle_error_handler.is_a?(Proc)
|
16
|
+
Devise.castle_error_handler.call(e)
|
17
|
+
end
|
18
|
+
end
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
@@ -23,12 +29,18 @@ Warden::Manager.before_failure do |env, opts|
|
|
23
29
|
end
|
24
30
|
|
25
31
|
castle = env['castle']
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
+
begin
|
33
|
+
castle.track(
|
34
|
+
name: '$login.failed',
|
35
|
+
user_id: user_id,
|
36
|
+
details: {
|
37
|
+
'$login' => opts[:username]
|
38
|
+
})
|
39
|
+
rescue ::Castle::Error => e
|
40
|
+
if Devise.castle_error_handler.is_a?(Proc)
|
41
|
+
Devise.castle_error_handler.call(e)
|
42
|
+
end
|
43
|
+
end
|
32
44
|
end
|
33
45
|
end
|
34
46
|
|
@@ -37,10 +49,13 @@ Warden::Manager.after_set_user :except => :fetch do |record, warden, opts|
|
|
37
49
|
if record.respond_to?(:castle_id)
|
38
50
|
unless record.respond_to?(:castle_do_not_track?) && record.castle_do_not_track?
|
39
51
|
castle = warden.request.env['castle']
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
52
|
+
begin
|
53
|
+
castle.track(user_id: record._castle_id, name: '$login.succeeded')
|
54
|
+
rescue ::Castle::Error => e
|
55
|
+
if Devise.castle_error_handler.is_a?(Proc)
|
56
|
+
Devise.castle_error_handler.call(e)
|
57
|
+
end
|
58
|
+
end
|
44
59
|
end
|
45
60
|
end
|
46
61
|
end
|
data/lib/devise_castle.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_castle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Brissmyr
|
8
|
+
- Sebastian Wallin
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2016-
|
12
|
+
date: 2016-04-04 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: devise
|
@@ -30,14 +31,14 @@ dependencies:
|
|
30
31
|
requirements:
|
31
32
|
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.2.
|
34
|
+
version: 1.2.13
|
34
35
|
type: :runtime
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.2.
|
41
|
+
version: 1.2.13
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
43
|
name: bundler
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,3 +128,4 @@ signing_key:
|
|
127
128
|
specification_version: 4
|
128
129
|
summary: Devise extension for Castle
|
129
130
|
test_files: []
|
131
|
+
has_rdoc:
|