quo_vadis 2.1.7 → 2.1.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: f2f5586e06a0e01dd89d66bf9cae01317b0d302ba51e5a82cfcb4bc00dc0ea85
4
- data.tar.gz: f37f34fbae6ab23081643aff844525b4ca8795c9e5057cbce737e7348d6a254f
3
+ metadata.gz: d11498bfa66e0397304c2d9a0f8ac504037f97beac4fd039fe6c8d0299696531
4
+ data.tar.gz: 2d1e267c7b55740c72087e297960ff6ececb1caee45a17eb588bf7e44ba64d31
5
5
  SHA512:
6
- metadata.gz: de242f63f325f1520fb9fb209535a4dfcff1c6f3f2e80d6620bce3e940c1000d5452145e83b6917e9106deb844aa4f467be922880c92bbb357da2dcb6bbf563b
7
- data.tar.gz: d706a441437cab9af6ee75f3581cc18df8edfd17414317555eecd58a1c984f7cc62a085297158fb5a42f9d244bcfdbde98bd6792220434a6118e32f801c0241e
6
+ metadata.gz: e4e7c7bb2996556b35b153c56916aef9834dcac2abea08ede8becc14e030d8f4ea1444f9286c1ca9b728c1a13c16d8d9b2e701255d57b769c7dc9abefa84a976
7
+ data.tar.gz: f466404a5ba44bfd506cbcd2fdc7b2f2d142ecab419363e3c368bb5eca67cfc78829afa698b8b0dc1cc76210b531a32a44c3bfdcd1ae709cf9eafe740861f089
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@
4
4
  ## HEAD
5
5
 
6
6
 
7
+ ## 2.1.8 (18 June 2022)
8
+
9
+ * Extract convenience method for has authentication account.
10
+ * Only authenticating models react to email change.
11
+
12
+
7
13
  ## 2.1.7 (30 May 2022)
8
14
 
9
15
  * Use SHA256 digest for encryption.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Quo Vadis
2
2
 
3
- Multifactor authentication for your Rails 6 app.
3
+ Multifactor authentication for your Rails 6 or Rails 7 app.
4
4
 
5
5
  Designed in accordance with the [OWASP Application Security Verification Standard](https://owasp.org/www-project-application-security-verification-standard/) and relevant [OWASP Cheatsheets](https://cheatsheetseries.owasp.org).
6
6
 
@@ -537,6 +537,6 @@ If you don't want a specific flash message at all, give the key an empty value i
537
537
 
538
538
  ## Intellectual Property
539
539
 
540
- Copyright 2011-2021 Andrew Stewart (boss@airbladesoftware.com).
540
+ Copyright 2011-2022 Andrew Stewart (boss@airbladesoftware.com).
541
541
 
542
542
  Released under the MIT licence.
@@ -14,7 +14,7 @@ module QuoVadis
14
14
 
15
15
  has_one :qv_account, as: :model, class_name: 'QuoVadis::Account', dependent: :destroy, autosave: true
16
16
 
17
- before_validation :qv_copy_identifier_to_account, if: Proc.new { |m| m.qv_account }
17
+ before_validation :qv_copy_identifier_to_account, if: :has_authentication_account?
18
18
 
19
19
  validate :qv_copy_password_errors, if: Proc.new { |m| m.qv_account&.password }
20
20
 
@@ -29,8 +29,8 @@ module QuoVadis
29
29
  qv_account.identifier = send identifier
30
30
  end
31
31
 
32
- after_update :qv_log_email_change, if: :saved_change_to_email?
33
- after_update :qv_notify_email_change, if: :saved_change_to_email?
32
+ after_update :qv_log_email_change, if: [:has_authentication_account?, :saved_change_to_email?]
33
+ after_update :qv_notify_email_change, if: [:has_authentication_account?, :saved_change_to_email?]
34
34
 
35
35
  QuoVadis.register_model self.name, identifier
36
36
  end
@@ -57,6 +57,10 @@ module QuoVadis
57
57
  qv_account.revoke
58
58
  end
59
59
 
60
+ def has_authentication_account?
61
+ !!qv_account
62
+ end
63
+
60
64
  private
61
65
 
62
66
  def qv_copy_password_errors
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module QuoVadis
4
- VERSION = '2.1.7'
4
+ VERSION = '2.1.8'
5
5
  end
@@ -66,4 +66,14 @@ class ModelTest < ActiveSupport::TestCase
66
66
  u.update email: 'robert@example.com'
67
67
  end
68
68
  end
69
+
70
+
71
+ test 'does not notify or log on email change when no account' do
72
+ u = User.create! name: 'bob', email: 'bob@example.com'
73
+ assert_no_difference 'QuoVadis::Log.count' do
74
+ assert_no_enqueued_emails do
75
+ u.update email: 'robert@example.com'
76
+ end
77
+ end
78
+ end
69
79
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quo_vadis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.7
4
+ version: 2.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Stewart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-30 00:00:00.000000000 Z
11
+ date: 2022-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails