devise_invitable 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of devise_invitable might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 853e0a1f85a22c77e6caa07a56e90cde6f0b54ad39651a756f73d213f2d8a085
4
- data.tar.gz: a824c95001fb09a4b9c2b11809c46bf7a4cc1ca667166889a1d8d0f8a3f842d0
3
+ metadata.gz: 0517f954240bfc3c1fd255df0d502d5fdbd461d4e695cd0c5ec725854af50dcf
4
+ data.tar.gz: 239b887a32e66dbc38fbf1e04625def2f1dea325fcc6d20af0e1befd066dd000
5
5
  SHA512:
6
- metadata.gz: 48e4376634d9c32e9703a635b9676c7aa6859ad5c9abaa7a301538d7b918871340304c0897fbf8b7c950398065a7254c88ecbc951f747bc4e3edb91a59a0baaf
7
- data.tar.gz: b5a98b61c21f14585205679a0577194df7c542214552970e9fa9eb0b6c81f93f35a7fd4fbf443904e1d25f4c817dd32dfca69f160b93d71c26bcc67e992c1f4a
6
+ metadata.gz: 957006ebe6e94715459f941b52004a1002e72005e9344baca46679398bc34e360604e3a8a205d9099a4ff5015be597c1c02a89055137db6c12f10ecf03949db7
7
+ data.tar.gz: 17200aa6cf76d5abf07de1e4c0987f197140087a7a3210df0bf948a6098602eeeab05d65983cc69ef2185f2de741813ebc778a28d476a86bc5b1527bbd918f4c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 2.0.5
2
+ - Fix NoMethodError in random_password when validatable is not used ([#850](https://github.com/scambra/devise_invitable/pull/850))
3
+
4
+ ## 2.0.4
5
+ - Fix devise deprecations ([#842](https://github.com/scambra/devise_invitable/pull/842))
6
+ - Update translations ([#844](https://github.com/scambra/devise_invitable/pull/844), [#845](https://github.com/scambra/devise_invitable/pull/845))
7
+ - Fix/enforce initial password length to follow devise ([#848](https://github.com/scambra/devise_invitable/pull/848))
8
+
1
9
  ## 2.0.3
2
10
  - Add locales ([#834](https://github.com/scambra/devise_invitable/pull/834), [#835](https://github.com/scambra/devise_invitable/pull/835))
3
11
  - Remove index on invitations_count column ([#830](https://github.com/scambra/devise_invitable/pull/830))
data/README.rdoc CHANGED
@@ -181,15 +181,15 @@ To change behaviour of inviting or accepting users, you can simply override two
181
181
  class Users::InvitationsController < Devise::InvitationsController
182
182
  private
183
183
 
184
- # this is called when creating invitation
185
- # should return an instance of resource class
184
+ # This is called when creating invitation.
185
+ # It should return an instance of resource class.
186
186
  def invite_resource
187
187
  # skip sending emails on invite
188
188
  super { |user| user.skip_invitation = true }
189
189
  end
190
190
 
191
- # this is called when accepting invitation
192
- # should return an instance of resource class
191
+ # This is called when accepting invitation.
192
+ # It should return an instance of resource class.
193
193
  def accept_resource
194
194
  resource = resource_class.accept_invitation!(update_resource_params)
195
195
  # Report accepting invitation to analytics
@@ -18,7 +18,7 @@ es:
18
18
  mailer:
19
19
  invitation_instructions:
20
20
  subject: "Instruciones de la invitación"
21
- hello: "Estimada/o %{nombre}"
21
+ hello: "Hola %{email}"
22
22
  someone_invited_you: "Has sido invitado a %{url}, puedes aceptarlo siguiendo el siguiente enlace"
23
23
  accept: "Aceptar la invitación"
24
24
  accept_until: "Esta invitación expirará en %{due_date}."
@@ -28,4 +28,4 @@ es:
28
28
  devise:
29
29
  mailer:
30
30
  invitation_instructions:
31
- accept_until_format: "%d de %B de %Y, %H:%M"
31
+ accept_until_format: "%d de %B de %Y, %H:%M"
@@ -20,7 +20,6 @@ ja:
20
20
  subject: '招待を承認するには'
21
21
  hello: 'こんにちは、%{email}さん'
22
22
  someone_invited_you: '%{url}に招待されました。以下のリンクから承認できます。'
23
- accept: 'Accept invitation'
24
23
  accept: '招待を承認する'
25
24
  accept_until: 'この招待は%{due_date}まで有効です。'
26
25
  ignore: '招待を承認しない場合は、このメールを無視してください。<br />あなたのアカウントは上記のリンク先にアクセスしパスワードを設定するまでは作成されません。'
@@ -397,7 +397,10 @@ module Devise
397
397
  # lower + upper case, a digit and a symbol.
398
398
  # For more unusual rules, this method can be overridden.
399
399
  def random_password
400
- 'aA1!' + Devise.friendly_token[0, 20]
400
+ length = respond_to?(:password_length) ? password_length : Devise.password_length
401
+
402
+ prefix = 'aA1!'
403
+ prefix + Devise.friendly_token(length.last - prefix.length)
401
404
  end
402
405
  end
403
406
  end
@@ -1,11 +1,17 @@
1
1
  module Devise
2
2
  module Models
3
3
  module Authenticatable
4
- BLACKLIST_FOR_SERIALIZATION.concat %i[
4
+ list = %i[
5
5
  invitation_token invitation_created_at invitation_sent_at
6
6
  invitation_accepted_at invitation_limit invited_by_type
7
7
  invited_by_id invitations_count
8
8
  ]
9
+
10
+ if defined?(UNSAFE_ATTRIBUTES_FOR_SERIALIZATION)
11
+ UNSAFE_ATTRIBUTES_FOR_SERIALIZATION.concat(list)
12
+ else
13
+ BLACKLIST_FOR_SERIALIZATION.concat(list)
14
+ end
9
15
  end
10
16
  end
11
17
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseInvitable
2
- VERSION = '2.0.3'.freeze
2
+ VERSION = '2.0.5'.freeze
3
3
  end
@@ -1,6 +1,10 @@
1
1
  require 'test_helper'
2
2
  require 'model_tests_helper'
3
3
 
4
+ class Validatable < User
5
+ devise :validatable, password_length: 10..20
6
+ end
7
+
4
8
  class InvitableTest < ActiveSupport::TestCase
5
9
 
6
10
  def setup
@@ -760,4 +764,16 @@ class InvitableTest < ActiveSupport::TestCase
760
764
  assert user.persisted?
761
765
  assert user.errors.empty?
762
766
  end
767
+
768
+ test 'should set initial password following Devise.password_length' do
769
+ user = User.invite!(email: 'valid@email.com')
770
+ assert_empty user.errors
771
+ assert_equal Devise.password_length.last, user.password.length
772
+ end
773
+
774
+ test 'should set initial passsword using :validatable with custom password_length' do
775
+ user = Validatable.invite!(email: 'valid@email.com')
776
+ assert_empty user.errors
777
+ assert_equal Validatable.password_length.last, user.password.length
778
+ end
763
779
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_invitable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-20 00:00:00.000000000 Z
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -186,8 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  requirements: []
189
- rubyforge_project:
190
- rubygems_version: 2.7.9
189
+ rubygems_version: 3.0.8
191
190
  signing_key:
192
191
  specification_version: 4
193
192
  summary: An invitation strategy for Devise