rails_jwt_auth 2.0.0 → 2.0.1

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
  SHA256:
3
- metadata.gz: d100761bfcdc7e5e07fff45041fba26137719a91ed545eb86048122554c2cf75
4
- data.tar.gz: 82af1efb56e73cf418fd8cf7d6ce78d959675da65e9fc441f256bac99002e833
3
+ metadata.gz: c3ebe38a69058ce05f15ec6ffce2a2d91654a4839596f710d099d5bfa8098173
4
+ data.tar.gz: e565d1eaeec61e94456190e0839e7462bc5d2578d5059c7fda24ff8e1fbc3823
5
5
  SHA512:
6
- metadata.gz: c20b1bda10504982186a9346ea1e8195ad55750f246da677b6b33be8fce50a6e63b0b21dfac4445c4517c553ed56415bbe17e6da02752dd345f060c152d88e66
7
- data.tar.gz: 6d7e93f646af890cfe65865c24e9fe38e76ff10ba4e8637fa813200b9e743921a77e4805d074ff5801e8548914062aa86c25a49ecdfe1d84c48f4aaff9b78de9
6
+ metadata.gz: d3a2e4a93d66ac10a88cd45e6bcf50a2e21977ec4bd1fb1e71df9cc837dce910f401c5d0f8c61e851e3a41773b9e6b61555b1fd8aa23de0d915770f8d3e450f2
7
+ data.tar.gz: 4541e70821d3f2e104702012107d3ee10ca30a26e3e773aacca3af6327846cb4695dd4416cb619ab750e8976b63b001cbb93687f080dfce0ea6d73c3d01afdbd
data/README.md CHANGED
@@ -363,7 +363,7 @@ It is necessary to set a value for `confirmations_url` option into `config/initi
363
363
 
364
364
  ### Password
365
365
 
366
- Password api is defined by `RailsJwtAuth::PasswordsController`.
366
+ Reset password api is defined by `RailsJwtAuth::ResetPasswordsController`.
367
367
 
368
368
  1. Send reset password email (init reset password process):
369
369
 
@@ -8,7 +8,7 @@ module RailsJwtAuth
8
8
  base.class_eval do
9
9
  if defined?(Mongoid) && ancestors.include?(Mongoid::Document)
10
10
  field :password_digest, type: String
11
- field :auth_tokens, type: Array if RailsJwtAuth.simultaneous_sessions > 0
11
+ field :auth_tokens, type: Array, default: [] if RailsJwtAuth.simultaneous_sessions > 0
12
12
  elsif defined?(ActiveRecord) && ancestors.include?(ActiveRecord::Base)
13
13
  serialize :auth_tokens, Array
14
14
  end
@@ -54,7 +54,7 @@ module RailsJwtAuth
54
54
 
55
55
  def to_token_payload(_request=nil)
56
56
  if RailsJwtAuth.simultaneous_sessions > 0
57
- {auth_token: auth_tokens.last}
57
+ auth_tokens&.last ? {auth_token: auth_tokens.last} : false
58
58
  else
59
59
  {id: id.to_s}
60
60
  end
@@ -9,6 +9,7 @@ module RailsJwtAuth
9
9
  NotInvitationsUrl = Class.new(StandardError)
10
10
  NotResetPasswordsUrl = Class.new(StandardError)
11
11
  NotUnlockUrl = Class.new(StandardError)
12
+ InvalidJwtPayload = Class.new(StandardError)
12
13
 
13
14
  mattr_accessor :model_name
14
15
  self.model_name = 'User'
@@ -8,6 +8,8 @@ module RailsJwtAuth
8
8
 
9
9
  # Encodes and signs JWT Payload with expiration
10
10
  def self.encode(payload)
11
+ raise InvalidJwtPayload unless payload
12
+
11
13
  payload.reverse_merge!(meta)
12
14
  JWT.encode(payload, secret_key_base)
13
15
  end
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAuth
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
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: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rjurado
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-14 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt