devise_castle 1.3.1 → 1.3.2

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
  SHA1:
3
- metadata.gz: 43245bf115aa0218597885bc3ed9140b14dd5659
4
- data.tar.gz: 5f65da1892251a537636b1b84e710c2e3430bf43
3
+ metadata.gz: fed2b4bde70c3fb648b8b73ba596ddae8c57c87c
4
+ data.tar.gz: 4235c9af1d89be5575a18c8247f0afc2c4f51e93
5
5
  SHA512:
6
- metadata.gz: d5e467806f6d9c0301ec39750bd1d20dee4bf2e2734accfe13c07e964bb4d3a0b4f46110eef2e4678324a6cce4b471ae148a4dca7241de1467bbd5a8cd7ca29e
7
- data.tar.gz: 6d5d6dd38c8740ce9dedc2759fee06723152517a5a422ffbdf9dbff98e1ac6562fe2125c62cc2f100ffb3e60af952da03003c897349a3090595c2ba056edebc3
6
+ metadata.gz: fa706cce1ce7efdf2e096ebf71b783106aed6595cfd4153a68be8c33ab6aebd9d81e51ae6c0dd4ac4e103ed051438f6dc314be5f8dc3751cb872f86ac77b59c0
7
+ data.tar.gz: 31eb367a77bef0ad819a3c15d20267755a41ad06cefab41d15f00f5496040d968e5fcdd47ff4704b6ec54ee8d0142891e6ba82b245ffe9251440da3b2cd5ccb6
@@ -9,6 +9,8 @@ class DeviseCastle::PasswordsController < Devise::PasswordsController
9
9
  end
10
10
 
11
11
  super do |resource|
12
+ return if resource.respond_to?(:castle_do_not_track?) && resource.castle_do_not_track?
13
+
12
14
  castle.track(
13
15
  name: '$password_reset.requested',
14
16
  details: {
@@ -19,6 +21,8 @@ class DeviseCastle::PasswordsController < Devise::PasswordsController
19
21
 
20
22
  def update
21
23
  super do |resource|
24
+ return if resource.respond_to?(:castle_do_not_track?) && resource.castle_do_not_track?
25
+
22
26
  if resource.errors.empty?
23
27
  castle.track(
24
28
  name: '$password_reset.succeeded',
@@ -0,0 +1,4 @@
1
+ en:
2
+ devise:
3
+ failure:
4
+ signed_out: 'You were automatically signed out.'
@@ -7,8 +7,10 @@ end
7
7
  # Track logout.succeeded
8
8
  Warden::Manager.before_logout do |record, warden, opts|
9
9
  if record.respond_to?(:castle_id)
10
- castle = warden.request.env['castle']
11
- castle.track(user_id: record._castle_id, name: '$logout.succeeded')
10
+ unless record.respond_to?(:castle_do_not_track?) && record.castle_do_not_track?
11
+ castle = warden.request.env['castle']
12
+ castle.track(user_id: record._castle_id, name: '$logout.succeeded')
13
+ end
12
14
  end
13
15
  end
14
16
 
@@ -33,10 +35,12 @@ end
33
35
  # Track login.succeeded
34
36
  Warden::Manager.after_set_user :except => :fetch do |record, warden, opts|
35
37
  if record.respond_to?(:castle_id)
36
- castle = warden.request.env['castle']
37
- castle.identify(record._castle_id, {
38
- email: record.email
39
- })
40
- castle.track(user_id: record._castle_id, name: '$login.succeeded')
38
+ unless record.respond_to?(:castle_do_not_track?) && record.castle_do_not_track?
39
+ castle = warden.request.env['castle']
40
+ castle.identify(record._castle_id, {
41
+ email: record.email
42
+ })
43
+ castle.track(user_id: record._castle_id, name: '$login.succeeded')
44
+ end
41
45
  end
42
46
  end
@@ -33,6 +33,15 @@
33
33
  def _castle_id
34
34
  URI.encode(castle_id.to_s)
35
35
  end
36
+
37
+ # Disable Devise model tracking
38
+ def castle_do_not_track!
39
+ @castle_do_not_track = true
40
+ end
41
+
42
+ def castle_do_not_track?
43
+ @castle_do_not_track || false
44
+ end
36
45
  end
37
46
  end
38
47
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseCastle
2
- VERSION = "1.3.1".freeze
2
+ VERSION = "1.3.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_castle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Brissmyr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-26 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.1.0
47
+ version: '1.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.1.0
54
+ version: '1.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +91,7 @@ files:
91
91
  - app/controllers/devise_castle/passwords_controller.rb
92
92
  - app/controllers/devise_castle/registrations_controller.rb
93
93
  - app/controllers/devise_castle/sessions_controller.rb
94
+ - config/locales/en.yml
94
95
  - lib/devise_castle.rb
95
96
  - lib/devise_castle/controllers/helpers.rb
96
97
  - lib/devise_castle/hooks.rb