rails_jwt_auth 0.15.1 → 0.15.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91e496764ccca7f97d93242efd60a3547aea74e1
4
- data.tar.gz: 74e02d9360d60324fd7eaa595045f00ced0d3424
3
+ metadata.gz: 75dd02f2d7bbefd337d60459bceb0d7f2751e189
4
+ data.tar.gz: 14216f9267af36d472e9a88075a010d7932ddd9d
5
5
  SHA512:
6
- metadata.gz: 5adc97101b64c29b798323a60b10f4c928076fe5d7114f39d5c8c02b0867137713b2093a840182e4118713507528b03071d6d79b81f3af377eef32101cc70496
7
- data.tar.gz: d973ea8cd11fc8b674e0288679fe8e91ce2498b26d1ee1771e4c026470bbd72a07c81caa2d8de44fb0f1845b273c74470b432f9c0ff0a86caa7370a5ea270659
6
+ metadata.gz: 956f217d584980202458ca7cc8cde55ef7e93a3441440b66536e07698ebd510b8652cb2a8da986495fbca3b2d02c818bf3e14dd86bb1290f9ab98903cae19ec5
7
+ data.tar.gz: da16eb6bd31092531ded7fc48067548752f9074f89886118aac8a60be67909ff79a969bf554f1a853d3347d620abb9ea822654beedd40cf329b91cd38cb61ffd
@@ -18,7 +18,7 @@ module RailsJwtAuth
18
18
  end
19
19
 
20
20
  unless password_update_params[:password].present?
21
- return render_422(password: [I18n.t('rails_jwt_auth.errors.invalid')])
21
+ return render_422(password: [I18n.t('rails_jwt_auth.errors.password.blank')])
22
22
  end
23
23
 
24
24
  user.update_attributes(password_update_params) ? render_204 : render_422(user.errors)
@@ -26,14 +26,16 @@ module RailsJwtAuth
26
26
 
27
27
  def update_with_password(params)
28
28
  if (current_password = params.delete(:current_password)).blank?
29
- errors.add(:current_password, I18n.t('rails_jwt_auth.errors.blank'))
30
- false
31
- elsif authenticate(current_password)
32
- update_attributes(params)
33
- else
34
- errors.add(:current_password, I18n.t('rails_jwt_auth.errors.invalid'))
35
- false
29
+ errors.add(:current_password, I18n.t('rails_jwt_auth.errors.current_password.blank'))
30
+ elsif !authenticate(current_password)
31
+ errors.add(:current_password, I18n.t('rails_jwt_auth.errors.current_password.invalid'))
32
+ end
33
+
34
+ if params[:password].blank?
35
+ errors.add(:password, I18n.t('rails_jwt_auth.errors.password.blank'))
36
36
  end
37
+
38
+ errors.empty? ? update_attributes(params) : false
37
39
  end
38
40
 
39
41
  module ClassMethods
@@ -1,7 +1,7 @@
1
1
  class EmailValidator < ActiveModel::EachValidator
2
2
  def validate_each(record, attribute, value)
3
3
  unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
4
- record.errors[attribute] << (options[:message] || I18n.t('rails_jwt_auth.errors.invalid_email'))
4
+ record.errors[attribute] << (options[:message] || I18n.t('rails_jwt_auth.errors.email.invalid'))
5
5
  end
6
6
  end
7
7
  end
@@ -13,4 +13,10 @@ en:
13
13
  invalid: "invalid"
14
14
  blank: "blank"
15
15
  not_found: "not found"
16
- invalid_email: "is not an email"
16
+ email:
17
+ invlid: "is not an email"
18
+ current_password:
19
+ blank: "blank"
20
+ invalid: "invalid"
21
+ password:
22
+ blank: "blank"
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAuth
2
- VERSION = '0.15.1'
2
+ VERSION = '0.15.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_jwt_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rjurado