ishapi 0.1.8.136 → 0.1.8.137

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: 5339296869058b6d82a54995cceebfd6006e45050a1964efeae15decc76ba82d
4
- data.tar.gz: d46ff74f622cee0e0f133305f3253a23ea9bbcf321bcc7489f59dbb3a21f23d5
3
+ metadata.gz: 4ea1237d3671ba3528065f0bbc15e6a684bb858a2a35383344d98b994812dcb2
4
+ data.tar.gz: 01f141ef6844db0a791350c25111c3d1abeacf500ee33428ea54bca0efc8fa71
5
5
  SHA512:
6
- metadata.gz: 13fac7d4bf3e24d386c2f192cfa2cfdf3210e51d77f2a9df305a15ffd67b2c8a2e65a5cd85eff0b368df4b0501f1352fc3d7ea9b4760c39c998b073908796e22
7
- data.tar.gz: ca09ad85b5a644461a68cd2aa80192cabcfd267f9f4fc3a5eb6e74cf44ad790375a163192d43bc38b4689a7c410eb3c66b3c7be9d7a10591e3a4cefccfc6a66c
6
+ metadata.gz: 72cf3aba0fd0e4666888d3e743e7ec0764276ee24a2cd6c5886183a14c99532dc3fa74b21a1d64d6b79bc5d30f391d9d1fc7db00a0d39a828019fad607464089
7
+ data.tar.gz: 81fa44fd7963acf87226f59f2d546e7a596667eaf7d1beb6febc83b343ef93bfc78274a1674133e785dcb1f721755b2c9bc911985083fe015809298924ecc391
@@ -29,8 +29,6 @@ module Ishapi
29
29
  @me = @graph.get_object( 'me', :fields => 'email' )
30
30
  @current_user = User.where( :email => @me['email'] ).first
31
31
 
32
- puts! @current_user, '#long_term_token @current_user'
33
-
34
32
  # send the jwt to client
35
33
  @jwt_token = encode(user_id: @current_user.id.to_s)
36
34
 
@@ -54,8 +52,6 @@ module Ishapi
54
52
  private
55
53
 
56
54
  def append_long_term_token
57
- puts! nil, 'append_long_term_token'
58
-
59
55
  if @long_term_token
60
56
  response.body = JSON.parse(response.body).merge({ long_term_token: @long_term_token }).to_json
61
57
  end
@@ -137,12 +133,8 @@ module Ishapi
137
133
  @current_user = current_user if Rails.env.test?
138
134
  end
139
135
 
140
- puts! @current_user, 'current_user'
141
- puts! @current_profile, 'current_profile'
142
-
143
136
  elsif 'jwt' == provider
144
137
  decoded = decode(params[:jwt_token])
145
- puts! decoded, 'decoded'
146
138
  @current_user = User.find decoded['user_id']
147
139
  else
148
140
  puts! 'check_multiprofile(): no access token'
@@ -156,12 +148,17 @@ module Ishapi
156
148
 
157
149
 
158
150
 
159
- # same as check_profile but doesn't error out when jwt_token is missing
151
+ # same as check_profile but doesn't error out when jwt_token is missing or expired
160
152
  def check_profile_optionally
161
153
  if !params[:jwt_token]
162
154
  @current_user = User.new profile: Profile.new
163
155
  else
164
- check_profile
156
+ begin
157
+ check_profile
158
+ rescue JWT::ExpiredSignature
159
+ Rails.logger.info("JWT::ExpiredSignature")
160
+ @current_user = User.new profile: Profile.new
161
+ end
165
162
  end
166
163
  end
167
164
 
@@ -173,10 +170,6 @@ module Ishapi
173
170
  # return check_multiprofile 'facebook'
174
171
  return check_multiprofile 'jwt'
175
172
 
176
- # puts! params, 'params'
177
- # puts! current_user, 'current_user'
178
- # puts! @current_user, '@current_user'
179
-
180
173
  accessToken = request.headers[:accessToken]
181
174
  accessToken ||= params[:fb_long_access_token]
182
175
  accessToken ||= params[:accessToken]
@@ -248,10 +241,9 @@ module Ishapi
248
241
  return token # ['access_token']
249
242
  end
250
243
 
251
- def set_current_ability
252
- # puts! current_user.email, '#set_current_ability() :: @current_user'
244
+ def current_ability
253
245
  @current_user ||= User.new({ profile: ::IshModels::UserProfile.new })
254
- @current_ability ||= ::Ishapi::Ability.new( @current_user )
246
+ @current_ability ||= Ishapi::Ability.new( @current_user )
255
247
  end
256
248
 
257
249
  def puts! a, b=''
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ishapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.136
4
+ version: 0.1.8.137
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-31 00:00:00.000000000 Z
11
+ date: 2021-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails