jwt-auth 2.0.0 → 2.1.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: 071e994384ea5a8b92ebcf11e387e0b3620c032d
4
- data.tar.gz: ff916fe29fb2df997ba8f526ef7dc2992d76f310
3
+ metadata.gz: b41cd772fd3da17cae17a45c21f90686d17d0cfd
4
+ data.tar.gz: 11722c972099efd07ea4bc4311fc57a6e3c45d88
5
5
  SHA512:
6
- metadata.gz: 96bfb99af4c98261d9d8069d6522d729a823100515deac9d2f3d0a37b3062cf9c185e95b0e307362344a319dc0159acf6b5958012378cd0e27fc46c7bac6757d
7
- data.tar.gz: 536591c41ada1b6d7f793d3dc3a070567e418ce6b9d0b1f8d5a48a32d2209b9833c431342db08d7766dad944b280f88e6da17b8a4c93e03b343747dfc7a2306b
6
+ metadata.gz: e40395a5846af7338bc32bd9f9812d20b7fe2e9c19a5a33eda0ff2bddd0b3dfb7c742366ad5a6f7f455a0d66d1ebc04df7b7cd6da86f41538be362387555c507
7
+ data.tar.gz: 954162e9bdb932df424d6812b574b0eaf5734802ed1f4dc42d46ace4a89288af4229926480501888c6dfe6481a99daf9dd7cb9c4cae596265ede5024002dd2a5
data/README.md CHANGED
@@ -42,6 +42,14 @@ class User < ApplicationRecord
42
42
  end
43
43
  ```
44
44
 
45
+ Optionally, define the `find_by_token` method on your model to allow additional checks (for example account activation):
46
+
47
+ ```ruby
48
+ def self.find_by_token(params)
49
+ find_by params.merge :activated => true
50
+ end
51
+ ```
52
+
45
53
  Add a `token_version` field to your user model:
46
54
 
47
55
  ```ruby
@@ -41,7 +41,9 @@ module JWT
41
41
 
42
42
  token = JWT::Auth::Token.new
43
43
  token.expiration = payload['exp']
44
- token.subject = JWT::Auth.model.find_by :id => payload['sub'], :token_version => payload['ver']
44
+
45
+ find_method = JWT::Auth.model.respond_to?(:find_by_token) ? :find_by_token : :find_by
46
+ token.subject = JWT::Auth.model.send find_method, :id => payload['sub'], :token_version => payload['ver']
45
47
 
46
48
  token
47
49
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module JWT
4
4
  module Auth
5
- VERSION = '2.0.0'
5
+ VERSION = '2.1.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jwt-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Dejonckheere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-07 00:00:00.000000000 Z
11
+ date: 2017-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt