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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 42492f6db41d9e509c1fe674f2a8c64a1c0b5e15
4
- data.tar.gz: 5c9ce4f27d593e926e3a236c7dee1a4c87540a04
2
+ SHA256:
3
+ metadata.gz: 324dfc68613286f41877c2f6d3f9af318fefa637acb15bd3b0067d000a33624f
4
+ data.tar.gz: 5e555ffaa34f030dff9804988d0667d300cd4016272032ddd495a5aa714decdf
5
5
  SHA512:
6
- metadata.gz: 7cd2d3c3c9fc3a1916740323c855847194c2bdbec856bf4499779938f58655517634b8ea5444baec9849b37932fd836a3aea320a3cf8c5595aa9357f1df6d08b
7
- data.tar.gz: 3f993fd85d29c3d3243c4328effbd5a1a5174abb8880828b82af206c0319dc6d4800b15a50743d54272c44eb67dfc45c56e0f186cbb540872cfe1747b4ceb2c7
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
- name: '$password_reset.requested',
16
- details: {
17
- '$login' => username
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
- name: '$password_reset.succeeded',
32
+ event: '$password_reset.succeeded',
35
33
  user_id: resource._castle_id)
36
34
  else
37
35
  castle.track(
38
- name: '$password_reset.failed',
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
- name: '$registration.succeeded',
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
- name: '$registration.failed')
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
- name: '$password_change.succeeded',
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
- name: '$password_change.failed',
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
@@ -1,5 +1,4 @@
1
1
  class DeviseCastle::SessionsController < Devise::SessionsController
2
- unloadable unless Rails.version =~/^4/
3
2
 
4
3
  protected
5
4
 
@@ -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, name: '$logout.succeeded')
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
- name: '$login.failed',
34
+ event: '$login.failed',
35
35
  user_id: user_id,
36
- details: {
37
- '$login' => opts[:username]
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.track(user_id: record._castle_id, name: '$login.succeeded')
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 default_controllers_with_castle(options)
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
- default_controllers_without_castle(options)
10
+ super
14
11
  end
15
12
  end
16
13
  end
@@ -5,7 +5,7 @@ module DeviseCastle
5
5
  end
6
6
 
7
7
  config.after_initialize do
8
- Devise::Mapping.send :include, DeviseCastle::Mapping
8
+ Devise::Mapping.send :prepend, DeviseCastle::Mapping
9
9
  end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseCastle
2
- VERSION = "1.4.1".freeze
2
+ VERSION = "2.0.0".freeze
3
3
  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: 1.4.1
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: 2016-07-14 00:00:00.000000000 Z
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: '3.0'
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: '3.0'
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: '1.2'
40
+ version: '2'
35
41
  - - "<"
36
42
  - !ruby/object:Gem::Version
37
- version: '2'
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: '1.2'
50
+ version: '2'
45
51
  - - "<"
46
52
  - !ruby/object:Gem::Version
47
- version: '2'
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: '1.1'
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: '1.1'
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.9'
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.9'
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: '3.1'
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: '3.1'
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.5.1
144
+ rubygems_version: 2.7.4
133
145
  signing_key:
134
146
  specification_version: 4
135
147
  summary: Devise extension for Castle