ibrain-auth 0.3.9 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/graphql/ibrain/mutations/sign_up_mutation.rb +4 -4
- data/app/graphql/ibrain/mutations/social_sign_in_mutation.rb +3 -3
- data/app/models/ibrain/user.rb +1 -4
- data/lib/generators/ibrain/auth/install/templates/config/initializers/ibrain_auth.rb.tt +7 -1
- data/lib/ibrain/auth/version.rb +1 -1
- data/lib/ibrain/auth_configuration.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0935c587e0ac8b76a54d04c05653d68c70a07363f89a3af411f4e3918fbd11d1'
|
4
|
+
data.tar.gz: 70f3c7d22fab3772c6a4c5765cb3b9d547c7b8f411dea589be8904d2d6a3a5f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 998a0df625b58e4706aa889f210937626d9eca61f72aec009cea7d124a5cba18591c49ffb1babd2a2045eafa535b7d88339985d8f29d87c5b7a86a019536c1bc
|
7
|
+
data.tar.gz: 0ca6852dfdb395256993145e5908a6165669e5d9abb56079ddc9ced9121470b00de8999e98d821b850fefbe983ff9c7bac72e2424392588e56cfaad74ea78971
|
@@ -8,7 +8,7 @@ module Ibrain::Mutations
|
|
8
8
|
argument :attributes, Ibrain::Auth::Config.sign_up_input, required: true
|
9
9
|
argument :device_token, String, description: 'Device token for notificaiton', required: false
|
10
10
|
|
11
|
-
def resolve(
|
11
|
+
def resolve(_args)
|
12
12
|
# TODO: define logic inside repository
|
13
13
|
return graphql_returning(false, false) if auth_resource.blank?
|
14
14
|
|
@@ -21,10 +21,10 @@ module Ibrain::Mutations
|
|
21
21
|
current_user.jti = jti
|
22
22
|
current_user.save!
|
23
23
|
|
24
|
-
if
|
25
|
-
device_token = current_user.device_tokens.find_by(token:
|
24
|
+
if params[:device_token].present?
|
25
|
+
device_token = current_user.device_tokens.find_by(token: params[:device_token])
|
26
26
|
|
27
|
-
current_user.device_tokens.create!({ token:
|
27
|
+
current_user.device_tokens.create!({ token: params[:device_token] }) if device_token.blank?
|
28
28
|
end
|
29
29
|
|
30
30
|
context[:current_user] = current_user
|
@@ -21,10 +21,10 @@ module Ibrain::Mutations
|
|
21
21
|
current_user.jti = jti
|
22
22
|
current_user.save!
|
23
23
|
|
24
|
-
if
|
25
|
-
device_token = current_user.device_tokens.find_by(token:
|
24
|
+
if params[:device_token].present?
|
25
|
+
device_token = current_user.device_tokens.find_by(token: params[:device_token])
|
26
26
|
|
27
|
-
current_user.device_tokens.create!({ token:
|
27
|
+
current_user.device_tokens.create!({ token: params[:device_token] }) if device_token.blank?
|
28
28
|
end
|
29
29
|
|
30
30
|
context[:current_user] = current_user
|
data/app/models/ibrain/user.rb
CHANGED
@@ -9,10 +9,7 @@ module Ibrain
|
|
9
9
|
self.abstract_class = true
|
10
10
|
self.table_name = Ibrain::Auth::Config.user_table_name
|
11
11
|
|
12
|
-
devise :
|
13
|
-
:recoverable, :validatable, :timeoutable, :omniauthable,
|
14
|
-
:jwt_authenticatable, jwt_revocation_strategy: self,
|
15
|
-
omniauth_providers: %i[apple facebook twitter line]
|
12
|
+
devise(*Ibrain::Auth::Config.devise_enabled_modules, jwt_revocation_strategy: self, omniauth_providers: Ibrain::Auth::Config.devise_omniauth_providers)
|
16
13
|
|
17
14
|
scope :find_by_line, ->(uid) {
|
18
15
|
find_by(uid: uid, provider: 'line')
|
@@ -26,6 +26,12 @@ Ibrain::Auth.config do |config|
|
|
26
26
|
# firebase owner email
|
27
27
|
config.firebase_owner_email = nil
|
28
28
|
|
29
|
-
# social
|
29
|
+
# social login graphql input
|
30
30
|
config.social_sign_in_input = Ibrain::Types::Input::SocialSignInInput
|
31
|
+
|
32
|
+
# devise modules setting
|
33
|
+
config.devise_enabled_modules = %i[database_authenticatable registerable confirmable recoverable validatable timeoutable omniauthable jwt_authenticatable]
|
34
|
+
|
35
|
+
# devise social providers setting
|
36
|
+
config.devise_omniauth_providers = %i[apple facebook twitter line]
|
31
37
|
end
|
data/lib/ibrain/auth/version.rb
CHANGED
@@ -27,6 +27,13 @@ module Ibrain
|
|
27
27
|
# firebase owner email
|
28
28
|
preference :firebase_owner_email, :string, default: nil
|
29
29
|
|
30
|
+
# social login graphql input
|
30
31
|
preference :social_sign_in_input, :class, default: Ibrain::Types::Input::SocialSignInInput
|
32
|
+
|
33
|
+
# devise modules setting
|
34
|
+
preference :devise_enabled_modules, :array, default: %i[database_authenticatable registerable confirmable recoverable validatable timeoutable omniauthable jwt_authenticatable]
|
35
|
+
|
36
|
+
# devise social providers setting
|
37
|
+
preference :devise_omniauth_providers, :array, default: %i[apple facebook twitter line]
|
31
38
|
end
|
32
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibrain-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tai Nguyen Van
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|