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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75dd02f2d7bbefd337d60459bceb0d7f2751e189
|
4
|
+
data.tar.gz: 14216f9267af36d472e9a88075a010d7932ddd9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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.
|
4
|
+
record.errors[attribute] << (options[:message] || I18n.t('rails_jwt_auth.errors.email.invalid'))
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
data/config/locales/en.yml
CHANGED