devise_invitable 2.0.4 → 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: 33d2068bde4821b3e6002383cd125e0be3710fea488c593c732401e73daeb5ab
4
- data.tar.gz: 9b7d81c9a6a8c288b083b932571e09826f1161fcba0f0a5147ce8f140037ec79
3
+ metadata.gz: 0517f954240bfc3c1fd255df0d502d5fdbd461d4e695cd0c5ec725854af50dcf
4
+ data.tar.gz: 239b887a32e66dbc38fbf1e04625def2f1dea325fcc6d20af0e1befd066dd000
5
5
  SHA512:
6
- metadata.gz: e6498c6caff72695aa36dd8092643f7d00eaf85022157d746c80c19228d43231372a0ef7a66e21ec817b8f8e477aff3db8a62c77197295ff8ef16827301d27a9
7
- data.tar.gz: 4e91e65cd46d4ee92b6efb2f47fbf0db7625b534e8e9efc9a3d25aa3bab483bdaf41d60e480c0dac5c42aa164043a5e669ca13e74302074ac6b8a79c1e338ca0
6
+ metadata.gz: 957006ebe6e94715459f941b52004a1002e72005e9344baca46679398bc34e360604e3a8a205d9099a4ff5015be597c1c02a89055137db6c12f10ecf03949db7
7
+ data.tar.gz: 17200aa6cf76d5abf07de1e4c0987f197140087a7a3210df0bf948a6098602eeeab05d65983cc69ef2185f2de741813ebc778a28d476a86bc5b1527bbd918f4c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
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
+
1
4
  ## 2.0.4
2
5
  - Fix devise deprecations ([#842](https://github.com/scambra/devise_invitable/pull/842))
3
6
  - Update translations ([#844](https://github.com/scambra/devise_invitable/pull/844), [#845](https://github.com/scambra/devise_invitable/pull/845))
@@ -397,8 +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
+ length = respond_to?(:password_length) ? password_length : Devise.password_length
401
+
400
402
  prefix = 'aA1!'
401
- prefix + Devise.friendly_token(self.password_length.last-prefix.length)
403
+ prefix + Devise.friendly_token(length.last - prefix.length)
402
404
  end
403
405
  end
404
406
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseInvitable
2
- VERSION = '2.0.4'.freeze
2
+ VERSION = '2.0.5'.freeze
3
3
  end
@@ -765,9 +765,15 @@ class InvitableTest < ActiveSupport::TestCase
765
765
  assert user.errors.empty?
766
766
  end
767
767
 
768
- test 'should set initial password following devise password_length' do
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
769
775
  user = Validatable.invite!(email: 'valid@email.com')
770
- user.update_attributes(profile_id: 1)
771
776
  assert_empty user.errors
777
+ assert_equal Validatable.password_length.last, user.password.length
772
778
  end
773
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.4
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: 2021-04-13 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