ishapi 0.1.8.87 → 0.1.8.91

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: d637206b4e2a512ecbc35e3657e9427bda2d9ef19a11c101aef20ea50b9e02b2
4
- data.tar.gz: e0011fc956d0cb87d832768189795c680e28f21439a4ac24d81ad51e81a17ed0
3
+ metadata.gz: 6090b8444ccdbb4ea1907531391aa20d64e3136062cb6a1351629ec336698a0d
4
+ data.tar.gz: 050c632b87dd6c9c2b34e3adb953b966a43578b328e2dc0c85928b4de2035c46
5
5
  SHA512:
6
- metadata.gz: 6540a1d16cf5985a5b46def8a81ca66bff1250b294b1b420e244479d0156661b42e79128dba4db9bc6337e343b675fa61a2345f6695709d23ce18bf36de7a853
7
- data.tar.gz: 9ae4e4210e95b9157cbb38c43389593cc0ac8ad2d36a6e1f4d12d43fd8e861aacefffe024b313ceb96cbb2fb5b601b2fc2410590e5d73f5e4edb54901c598f31
6
+ metadata.gz: 99efbb472c664f58ed0bbed15413b2660bb36c27ee5c26e816ec001b934f648772a871957f2ea5d908f1673baeedbf2aba4efa59a866e7fe1a0583ae18d490bc
7
+ data.tar.gz: 217f51c6559aaf30a05161e29d2a95929b1883e47993623c5e05507f9fe8f45f5a91c7db6323b8c46b14585b8a3bf48b531e4259f0406bb3ae4ee7a8a12107af
@@ -3,7 +3,7 @@ module Ishapi
3
3
  protect_from_forgery :prepend => true, :with => :exception
4
4
  layout :false
5
5
 
6
- before_action :check_profile, except: [ :test ]
6
+ # before_action :check_profile, except: [ :test ]
7
7
  # before_action :set_current_ability
8
8
 
9
9
  check_authorization
@@ -18,7 +18,7 @@ module Ishapi
18
18
  private
19
19
 
20
20
  def check_multiprofile provider = 'google'
21
- if provider == 'google'
21
+ if 'google' == provider
22
22
  # client_secrets = ::Google::APIClient::ClientSecrets.load
23
23
  # accessToken = params[:accessToken]
24
24
  # authorization = ::Google::Auth.get_application_default
@@ -28,17 +28,29 @@ module Ishapi
28
28
  decoded_token = JWT.decode params[:idToken], nil, false
29
29
 
30
30
  @current_user = User.find_by email: decoded_token[0]['email']
31
- # puts! @current_user.email, 'multiprofile'
32
31
 
33
- sign_in @current_user, scope: :user
34
- set_current_ability
32
+ elsif 'facebook' == provider
33
+ accessToken = request.headers[:accessToken]
34
+ accessToken ||= params[:fb_long_access_token]
35
+ accessToken ||= params[:accessToken]
36
+ if accessToken
37
+ @graph = Koala::Facebook::API.new( accessToken )
38
+ @me = @graph.get_object( 'me', :fields => 'email' )
39
+ @current_user = User.find_by :email => @me['email']
40
+ else
41
+ @current_user = current_user if Rails.env.test?
42
+ end
35
43
  end
44
+
45
+ sign_in @current_user, scope: :user
46
+ set_current_ability
36
47
  end
37
48
 
38
49
  # this doesn't generate long-lived token, doesn't update user_profile
39
50
  # this is only for facebook?
40
51
  def check_profile
41
- return check_multiprofile 'google'
52
+ # return check_multiprofile 'google'
53
+ return check_multiprofile 'facebook'
42
54
 
43
55
  # puts! params, 'params'
44
56
  # puts! current_user, 'current_user'
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.87
4
+ version: 0.1.8.91
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-11 00:00:00.000000000 Z
11
+ date: 2019-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails