rails_jwt_auth 0.14.0 → 0.15.0

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: 84bbab8a21df1dc0ab2aa4f1a4b3cf6bcdeeb300
4
- data.tar.gz: 8c70773e3fa6760e87060c6d7540e733ae4b964f
3
+ metadata.gz: 44a233123ae5f2a0f6b39250ba799f8e31b2eea7
4
+ data.tar.gz: e0ed55e3d8c7f7912fca191a9232d9d961765f36
5
5
  SHA512:
6
- metadata.gz: e9a59be18b4bb7579f66ff79c1beae53ea8b125ed8a7b521d587113535491e6151a83ba4469306bab5b3a093edd83b1b3dbf2dbe54a2103cf689d15bc276da56
7
- data.tar.gz: 6a4617b02cae8cc664eafbc08e315dcbd7cc6b171bd2013cda4266f5a1df6cbd47d783b415bf9f815843e0e82edfdd426f55c473a5d6346d8add9567cb86e5b9
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] || "is not an email")
4
+ record.errors[attribute] << (options[:message] || I18n.t('rails_jwt_auth.errors.invalid_email'))
5
5
  end
6
6
  end
7
7
  end
@@ -13,3 +13,4 @@ en:
13
13
  invalid: "invalid"
14
14
  blank: "blank"
15
15
  not_found: "not found"
16
+ invalid_email: "is not an email"
@@ -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
- @jwt_info = RailsJwtAuth::Jwt::Manager.decode(@jwt)
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
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAuth
2
- VERSION = '0.14.0'
2
+ VERSION = '0.15.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: 0.14.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 00:00:00.000000000 Z
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.1
128
+ rubygems_version: 2.5.2
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Rails jwt authentication.