rails_jwt_auth 0.14.0 → 0.15.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44a233123ae5f2a0f6b39250ba799f8e31b2eea7
|
4
|
+
data.tar.gz: e0ed55e3d8c7f7912fca191a9232d9d961765f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6ab7cb0cd8afc764a7e4afa8d2924b12b11de19764ac6138047a2488214ab84fc98d982f67e5efe634f06d041473ed5b18cee11504a335e37117750bc4ca220
|
7
|
+
data.tar.gz: e358f3a9332e4a2a2a75cb0d2e04677008e962e7feefac5a0f60a141bda4818841885b0b04a9d29c44ff902c0004a855266c17e03a71f7b507f2ef9dfd78b459
|
@@ -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] ||
|
4
|
+
record.errors[attribute] << (options[:message] || I18n.t('rails_jwt_auth.errors.invalid_email'))
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
data/config/locales/en.yml
CHANGED
@@ -6,11 +6,16 @@ module RailsJwtAuth
|
|
6
6
|
def initialize(request)
|
7
7
|
return unless request.env['HTTP_AUTHORIZATION']
|
8
8
|
@jwt = request.env['HTTP_AUTHORIZATION'].split.last
|
9
|
-
|
9
|
+
|
10
|
+
begin
|
11
|
+
@jwt_info = RailsJwtAuth::Jwt::Manager.decode(@jwt)
|
12
|
+
rescue JWT::ExpiredSignature
|
13
|
+
@jwt_info = false
|
14
|
+
end
|
10
15
|
end
|
11
16
|
|
12
17
|
def valid?
|
13
|
-
@jwt && RailsJwtAuth::Jwt::Manager.valid_payload?(payload)
|
18
|
+
@jwt && @jwt_info && RailsJwtAuth::Jwt::Manager.valid_payload?(payload)
|
14
19
|
end
|
15
20
|
|
16
21
|
def payload
|
@@ -7,10 +7,10 @@ module RailsJwtAuth
|
|
7
7
|
jwt = RailsJwtAuth::Jwt::Request.new(request)
|
8
8
|
|
9
9
|
if jwt.valid? && (model = RailsJwtAuth.model.get_by_token(jwt.auth_token))
|
10
|
-
success!(model)
|
11
|
-
else
|
12
|
-
fail!('strategies.authentication_token.failed')
|
10
|
+
return success!(model)
|
13
11
|
end
|
12
|
+
|
13
|
+
fail!('strategies.authentication_token.failed')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
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: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rjurado
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.5.
|
128
|
+
rubygems_version: 2.5.2
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Rails jwt authentication.
|