rails_jwt_auth 1.0.2 → 1.1.0

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: 36b16ddc288defd93e036c0de0ceb3c84c024541a8112fd647403ec9afe65149
4
- data.tar.gz: 9f2e7eaebf26f06d7c91eafcac4d5784b589aaaf00e14f4de160110e31bfb6f2
3
+ metadata.gz: c1cf5f9e135d2a39af71b620311285fdc6101de29a3e6481f54ca78551ca1a23
4
+ data.tar.gz: 45c733d715e884419e4d1174c83ea64d9f706e0449c7e652a18a3e57718b2967
5
5
  SHA512:
6
- metadata.gz: d1beb3b5f74b2ba099b9f1a373090bfd19114ae262f6013a3252c66935982dfb2171ac8807d7d559af0fcfe851992848dd0585b612c9c3c7bdf96fc2f2c5a3a8
7
- data.tar.gz: 9423c311c2e7e2ee99cfc1d26f2d03ea00c8309062a750a31c36e52504368d7a43d3e0bbd0ec0357b12c3c61f6d4a9e43afdad4e938ee8bf46aac918906e25fc
6
+ metadata.gz: af13c3b614e7263432c61eda040d619ace560a87fc409caa74a1d8c396bf6747790bc855ba5ce6b3167e0d84fef48692340f3b71f6eb78859e0012c657e3a977
7
+ data.tar.gz: 8017970563305ab55b8cd59c151f35093fac4c49d92bf60e51ddb794d3d695dd3f6a188811078942ca74c9689d3faf30b8af5d85fbe421c4c5aade60279f3c10
@@ -40,19 +40,20 @@ module RailsJwtAuth
40
40
  end
41
41
 
42
42
  def update_with_password(params)
43
- if (current_password = params.delete(:current_password)).blank?
44
- errors.add(:current_password, 'blank')
45
- elsif !authenticate(current_password)
46
- errors.add(:current_password, 'invalid')
47
- end
43
+ current_password_error = if (current_password = params.delete(:current_password)).blank?
44
+ 'blank'
45
+ elsif !authenticate(current_password)
46
+ 'invalid'
47
+ end
48
48
 
49
- if params[:password].blank?
50
- errors.add(:password, 'blank')
51
- end
49
+ # abort reset password if exists to allow save
50
+ self.reset_password_token = self.reset_password_sent_at = nil if reset_password_token
52
51
 
53
- params.merge!(reset_password_token: nil, reset_password_sent_at: nil) if reset_password_token
52
+ assign_attributes(params)
53
+ valid? # validates first other fields
54
+ errors.add(:current_password, current_password_error) if current_password_error
54
55
 
55
- errors.empty? ? update_attributes(params) : false
56
+ errors.empty? ? save : false
56
57
  end
57
58
 
58
59
  def to_token_payload(_request=nil)
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAuth
2
- VERSION = '1.0.2'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_jwt_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rjurado
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt