effective_resources 2.22.1 → 2.22.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
  SHA256:
3
- metadata.gz: 9f1b13829195775799805a0687e93edf636a0212ba8605121c0f2b71664bbe4b
4
- data.tar.gz: 6c13fd710c92f283595aebd9ed7553c8b06baef6e91f6bc71719558069ff0748
3
+ metadata.gz: 155b88e4f6e0f28971593f6c25da4f9c787a0da62ef6f7f851cec0496def856e
4
+ data.tar.gz: 1ad5f683874982e47be3186363354adf0460bfb4af7ed4c4c2e922341a34de66
5
5
  SHA512:
6
- metadata.gz: 77aed690165d729baaacc3bb62fab2d556ec19f88c0da70e0108a61a1aac6dc8572ca1ed3af96c871b59383846403cd76684723e1d2b1ac8dabe66f2612f455e
7
- data.tar.gz: 1da231ac069c526ff2d4f1e77ef7a9d5f7bea5e005c72bf08bb879854b4761cca71e185b6882919d4fc5b6d8e342d9a5d07cdd70460fe222e7fd921b064e3fb7
6
+ metadata.gz: 3dca56a7285c363e1bdbb79f775c53d3e645788ecf783caaa72ade6824b191998824548069b6b52ab6d1d78b37828ce5a730c51d92a74810f80cfd1cae44f668
7
+ data.tar.gz: baa235bfd2a657daae89b7ae1e5103f10ae9c41e47c4d2fd3e1d18160f7f9eb399d494c614927fa089991209830c50c2c85573c83be0e81751ce4c78d23f9ff3
@@ -96,7 +96,7 @@ module ActsAsPurchasableWizard
96
96
  # From Billing Step
97
97
  order.billing_address = owner.billing_address if owner.try(:billing_address).present?
98
98
 
99
- # This will update all order items to match the prices from their purchasable
99
+ # This will assign all order items to match the prices from their purchasable
100
100
  order.try(:update_purchasable_attributes)
101
101
 
102
102
  # Handle effective_memberships coupon fees price reduction
@@ -45,25 +45,6 @@ module EffectiveDeviseUser
45
45
  avatar_url :string
46
46
  end
47
47
 
48
- # Devise invitable ignores model validations, so we manually check for duplicate email addresses.
49
- before_save(if: -> { new_record? && try(:invitation_sent_at).present? }) do
50
- if email.blank?
51
- errors.add(:email, "can't be blank")
52
- raise("email can't be blank")
53
- end
54
-
55
- value = email.strip.downcase
56
-
57
- if self.class.where(email: value).present?
58
- errors.add(:email, 'has already been taken')
59
- raise("email has already been taken")
60
- end
61
-
62
- if respond_to?(:alternate_email) && self.class.where(alternate_email: value).present?
63
- errors.add(:email, 'has already been taken')
64
- raise("email has already been taken")
65
- end
66
- end
67
48
 
68
49
  # Clear the provider if an oauth signed in user resets password
69
50
  before_save(if: -> { persisted? && encrypted_password_changed? }) do
@@ -245,6 +226,30 @@ module EffectiveDeviseUser
245
226
  super(value.to_s.strip.downcase.presence)
246
227
  end
247
228
 
229
+ # Devise invitable ignores model validations, so we manually check for duplicate email addresses.
230
+ def invite!(invited_by = nil, options = {})
231
+ if new_record?
232
+ value = email.to_s.strip.downcase
233
+
234
+ if value.blank?
235
+ errors.add(:email, "can't be blank")
236
+ return false
237
+ end
238
+
239
+ if self.class.where(email: value).present?
240
+ errors.add(:email, 'has already been taken')
241
+ return false
242
+ end
243
+
244
+ if respond_to?(:alternate_email) && self.class.where(alternate_email: value).present?
245
+ errors.add(:email, 'has already been taken')
246
+ return false
247
+ end
248
+ end
249
+
250
+ super
251
+ end
252
+
248
253
  def reinvite!
249
254
  invite!
250
255
  end
@@ -258,6 +263,13 @@ module EffectiveDeviseUser
258
263
  false
259
264
  end
260
265
 
266
+ # This allows the Sign Up form to work for existing users with a pending invitation
267
+ # It assigns the attributes from the sign_up_params, saves the user, accepts the invitation
268
+ # Note that this action skips the invitation_token validation and is therefore insecure.
269
+ def allow_sign_up_from_invitation?
270
+ true
271
+ end
272
+
261
273
  def inactive_message
262
274
  (respond_to?(:archived?) && archived?) ? :archived : super
263
275
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.22.1'.freeze
2
+ VERSION = '2.22.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.22.1
4
+ version: 2.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-04 00:00:00.000000000 Z
11
+ date: 2024-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails