rails_jwt_auth 0.22.0 → 0.23.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
  SHA256:
3
- metadata.gz: 8f352112fd6b12718777361e279d9e4ff743cc60ff9fe631ea21379478dc3040
4
- data.tar.gz: 94981bb16178f532ce0ef5c7ec5da60b3afd8c85483a884c3fae8ddb6303429c
3
+ metadata.gz: ece5fffcb405896636167d181c6d75ef80a69c02b244c2310490ad48fde1c19b
4
+ data.tar.gz: df24cb6685d1de75e4639678801bc205011ee3d713a41ad765044bf994da449a
5
5
  SHA512:
6
- metadata.gz: 26221283e2e5fa7191d37fc41470dc60ca3aee634a69de10d2b5844fe34ac9fc3329840f74ceac08209bc0bdd77ee5666cb15bb3dd0a79721a46e9446fff19db
7
- data.tar.gz: fc03b5a3fb9642674de2f218fdbcc733c57ad5c7fa39dd77299129c14d4b7f2fc3e2040366fe3e15abee0fa67e15f57258b16ffd86849eea96e18f0da9219d60
6
+ metadata.gz: dbda81eef8a5117e1e1e53458f78c4aa2db1b3277539b8b7a5786058d441f2025d0273c353c96d55f2f6a90d54336ba6da13bcad3fad932863ae15b7e70978e6
7
+ data.tar.gz: 7423f74466fe56424ae6170469c64bf60326b303e578b74ece7a8c90ba06f79f4fa87d1b49b79d7b0f3a64633a208a9992d45c5cbecf430a14ea43a5efa132af
@@ -13,6 +13,10 @@ module RailsJwtAuth
13
13
  render json: {}, status: 204
14
14
  end
15
15
 
16
+ def render_404
17
+ render json: {}, status: 404
18
+ end
19
+
16
20
  def render_422(errors)
17
21
  render json: {errors: errors}, status: 422
18
22
  end
@@ -5,7 +5,7 @@ module RailsJwtAuth
5
5
  end
6
6
 
7
7
  def current_user
8
- warden.user
8
+ warden&.user
9
9
  end
10
10
 
11
11
  def warden
@@ -19,6 +19,8 @@ module RailsJwtAuth
19
19
  def self.included(base)
20
20
  return unless Rails.env.test? && base.name == 'ApplicationController'
21
21
 
22
+ return unless defined?(RailsJwtAuth::Spec::NotAuthorized)
23
+
22
24
  base.send(:rescue_from, RailsJwtAuth::Spec::NotAuthorized) do
23
25
  render json: {}, status: 401
24
26
  end
@@ -12,6 +12,9 @@ module RailsJwtAuth
12
12
  def update
13
13
  attr_hash = invitation_update_params
14
14
  user = RailsJwtAuth.model.where(invitation_token: params[:id]).first
15
+
16
+ return render_404 if user.blank?
17
+
15
18
  user.assign_attributes attr_hash
16
19
  user.accept_invitation!
17
20
 
@@ -55,7 +55,7 @@ module RailsJwtAuth
55
55
 
56
56
  if valid_invitation?
57
57
  accept_invitation
58
- self.confirmed_at = Time.now.utc if respond_to? :confirmed_at
58
+ self.confirmed_at = Time.now.utc if respond_to?(:confirmed_at) && confirmed_at.nil?
59
59
  else
60
60
  errors.add(:invitation_token, :invalid)
61
61
  end
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAuth
2
- VERSION = '0.22.0'
2
+ VERSION = '0.23.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.22.0
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rjurado
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-27 00:00:00.000000000 Z
11
+ date: 2018-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt