devise_castle 1.4.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/controllers/devise_castle/passwords_controller.rb +5 -7
- data/app/controllers/devise_castle/registrations_controller.rb +11 -9
- data/app/controllers/devise_castle/sessions_controller.rb +0 -1
- data/lib/devise_castle/hooks.rb +5 -5
- data/lib/devise_castle/mapping.rb +2 -5
- data/lib/devise_castle/railtie.rb +1 -1
- data/lib/devise_castle/version.rb +1 -1
- metadata +31 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 324dfc68613286f41877c2f6d3f9af318fefa637acb15bd3b0067d000a33624f
|
4
|
+
data.tar.gz: 5e555ffaa34f030dff9804988d0667d300cd4016272032ddd495a5aa714decdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dff55e8aacf6c36c5128ec482cfb40eea2d8857a7459a7fa65ce9d0c784892dad4429602474b479abbc504c274b16c5a7e946573c191b43ebe234da63ec4277d
|
7
|
+
data.tar.gz: 4174686cbe74e108af22f08b4d1a6fbcde9407df0a856e52eb41a17d63d053803db05c629950d19e791b8824e5e620121dca14582abd8b2638fcadd91b15ba8d
|
@@ -1,6 +1,4 @@
|
|
1
1
|
class DeviseCastle::PasswordsController < Devise::PasswordsController
|
2
|
-
unloadable unless Rails.version =~/^4/
|
3
|
-
|
4
2
|
def create
|
5
3
|
key = resource_params.keys.first
|
6
4
|
|
@@ -12,9 +10,9 @@ class DeviseCastle::PasswordsController < Devise::PasswordsController
|
|
12
10
|
unless resource.respond_to?(:castle_do_not_track?) && resource.castle_do_not_track?
|
13
11
|
begin
|
14
12
|
castle.track(
|
15
|
-
|
16
|
-
|
17
|
-
'
|
13
|
+
event: '$password_reset.requested',
|
14
|
+
user_traits: {
|
15
|
+
'email' => username
|
18
16
|
})
|
19
17
|
rescue ::Castle::Error => e
|
20
18
|
if Devise.castle_error_handler.is_a?(Proc)
|
@@ -31,11 +29,11 @@ class DeviseCastle::PasswordsController < Devise::PasswordsController
|
|
31
29
|
begin
|
32
30
|
if resource.errors.empty?
|
33
31
|
castle.track(
|
34
|
-
|
32
|
+
event: '$password_reset.succeeded',
|
35
33
|
user_id: resource._castle_id)
|
36
34
|
else
|
37
35
|
castle.track(
|
38
|
-
|
36
|
+
event: '$password_reset.failed',
|
39
37
|
user_id: resource._castle_id)
|
40
38
|
end
|
41
39
|
rescue ::Castle::Error => e
|
@@ -1,16 +1,16 @@
|
|
1
1
|
class DeviseCastle::RegistrationsController < Devise::RegistrationsController
|
2
|
-
unloadable unless Rails.version =~/^4/
|
3
|
-
|
4
2
|
def create
|
5
3
|
super do |resource|
|
6
4
|
begin
|
7
5
|
if resource.persisted?
|
8
6
|
castle.track(
|
9
|
-
|
10
|
-
user_id: resource._castle_id
|
7
|
+
event: '$registration.succeeded',
|
8
|
+
user_id: resource._castle_id
|
9
|
+
)
|
11
10
|
else
|
12
11
|
castle.track(
|
13
|
-
|
12
|
+
event: '$registration.failed'
|
13
|
+
)
|
14
14
|
end
|
15
15
|
rescue ::Castle::Error => e
|
16
16
|
if Devise.castle_error_handler.is_a?(Proc)
|
@@ -27,12 +27,14 @@ class DeviseCastle::RegistrationsController < Devise::RegistrationsController
|
|
27
27
|
if params['password'].present?
|
28
28
|
if resource_updated
|
29
29
|
castle.track(
|
30
|
-
|
31
|
-
user_id: resource._castle_id
|
30
|
+
event: '$password_change.succeeded',
|
31
|
+
user_id: resource._castle_id
|
32
|
+
)
|
32
33
|
else
|
33
34
|
castle.track(
|
34
|
-
|
35
|
-
user_id: resource._castle_id
|
35
|
+
event: '$password_change.failed',
|
36
|
+
user_id: resource._castle_id
|
37
|
+
)
|
36
38
|
end
|
37
39
|
end
|
38
40
|
rescue ::Castle::Error => e
|
data/lib/devise_castle/hooks.rb
CHANGED
@@ -10,7 +10,7 @@ Warden::Manager.before_logout do |record, warden, opts|
|
|
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,
|
13
|
+
castle.track(user_id: record._castle_id, event: '$logout.succeeded')
|
14
14
|
rescue ::Castle::Error => e
|
15
15
|
if Devise.castle_error_handler.is_a?(Proc)
|
16
16
|
Devise.castle_error_handler.call(e)
|
@@ -31,10 +31,10 @@ Warden::Manager.before_failure do |env, opts|
|
|
31
31
|
castle = env['castle']
|
32
32
|
begin
|
33
33
|
castle.track(
|
34
|
-
|
34
|
+
event: '$login.failed',
|
35
35
|
user_id: user_id,
|
36
|
-
|
37
|
-
'
|
36
|
+
user_traits: {
|
37
|
+
'email' => opts[:username]
|
38
38
|
})
|
39
39
|
rescue ::Castle::Error => e
|
40
40
|
if Devise.castle_error_handler.is_a?(Proc)
|
@@ -50,7 +50,7 @@ Warden::Manager.after_set_user :except => :fetch do |record, warden, opts|
|
|
50
50
|
unless record.respond_to?(:castle_do_not_track?) && record.castle_do_not_track?
|
51
51
|
castle = warden.request.env['castle']
|
52
52
|
begin
|
53
|
-
castle.
|
53
|
+
castle.authenticate(user_id: record._castle_id, event: '$login.succeeded')
|
54
54
|
rescue ::Castle::Error => e
|
55
55
|
if Devise.castle_error_handler.is_a?(Proc)
|
56
56
|
Devise.castle_error_handler.call(e)
|
@@ -1,16 +1,13 @@
|
|
1
1
|
module DeviseCastle
|
2
2
|
module Mapping
|
3
|
-
def self.included(base)
|
4
|
-
base.alias_method_chain :default_controllers, :castle
|
5
|
-
end
|
6
3
|
|
7
4
|
private
|
8
|
-
def
|
5
|
+
def default_controllers(options)
|
9
6
|
options[:controllers] ||= {}
|
10
7
|
options[:controllers][:sessions] ||= "devise_castle/sessions"
|
11
8
|
options[:controllers][:registrations] ||= "devise_castle/registrations"
|
12
9
|
options[:controllers][:passwords] ||= "devise_castle/passwords"
|
13
|
-
|
10
|
+
super
|
14
11
|
end
|
15
12
|
end
|
16
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_castle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Brissmyr
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise
|
@@ -17,76 +17,88 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '4.0'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '5'
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
28
|
- - ">="
|
26
29
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
30
|
+
version: '4.0'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5'
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: castle-rb
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
31
37
|
requirements:
|
32
38
|
- - ">="
|
33
39
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
40
|
+
version: '2'
|
35
41
|
- - "<"
|
36
42
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
43
|
+
version: '3'
|
38
44
|
type: :runtime
|
39
45
|
prerelease: false
|
40
46
|
version_requirements: !ruby/object:Gem::Requirement
|
41
47
|
requirements:
|
42
48
|
- - ">="
|
43
49
|
- !ruby/object:Gem::Version
|
44
|
-
version: '
|
50
|
+
version: '2'
|
45
51
|
- - "<"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '3'
|
48
54
|
- !ruby/object:Gem::Dependency
|
49
55
|
name: bundler
|
50
56
|
requirement: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '0'
|
55
61
|
type: :development
|
56
62
|
prerelease: false
|
57
63
|
version_requirements: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - "
|
65
|
+
- - ">="
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
67
|
+
version: '0'
|
62
68
|
- !ruby/object:Gem::Dependency
|
63
69
|
name: rake
|
64
70
|
requirement: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - "
|
72
|
+
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
74
|
+
version: '0'
|
69
75
|
type: :development
|
70
76
|
prerelease: false
|
71
77
|
version_requirements: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
|
-
- - "
|
79
|
+
- - ">="
|
74
80
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
81
|
+
version: '0'
|
76
82
|
- !ruby/object:Gem::Dependency
|
77
83
|
name: rails
|
78
84
|
requirement: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
86
|
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
88
|
+
version: '4'
|
89
|
+
- - "<"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '6'
|
83
92
|
type: :development
|
84
93
|
prerelease: false
|
85
94
|
version_requirements: !ruby/object:Gem::Requirement
|
86
95
|
requirements:
|
87
96
|
- - ">="
|
88
97
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
98
|
+
version: '4'
|
99
|
+
- - "<"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '6'
|
90
102
|
description: Devise extension for Castle. Secure your authentication stack with real-time
|
91
103
|
monitoring, instantly notifying you and your users on potential account hijacks.
|
92
104
|
email: johan@castle.io
|
@@ -129,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
141
|
version: '0'
|
130
142
|
requirements: []
|
131
143
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.7.4
|
133
145
|
signing_key:
|
134
146
|
specification_version: 4
|
135
147
|
summary: Devise extension for Castle
|