ibrain-auth 0.3.13 → 0.3.14
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5173b53bdb3dee4b0ba2d5e7f4e44d437bcd3e4aa574573d8989b54a0dee945d
|
4
|
+
data.tar.gz: c349e50c8b0319979fdd23279a051b7af238d09d44f4ce7a31f327f84146a915
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16bcd457e52d08d65a6332c85bcb7106484ea33d3dfbd4b9964349f0ecfefe6781ea4840b21359845cbb8064b4670a80fc1e9f445743e77969abf13f539907ee
|
7
|
+
data.tar.gz: e0cd0e369b2a39ee5661c31b4f7db8baf1c999c7ea7f168eefaa141bdcc5fce72cb3a1c9763df93bbb06ec2054ddd530779cae0bf9d306d1a4d5b510cb0dafc2
|
data/app/models/ibrain/user.rb
CHANGED
@@ -68,6 +68,10 @@ module Ibrain
|
|
68
68
|
user.skip_confirmation! unless user&.confirmed?
|
69
69
|
user
|
70
70
|
end
|
71
|
+
|
72
|
+
def random_password
|
73
|
+
(('A'..'Z').to_a.sample(4) + ["~", "!", "@", "#", "$", "%", "^", "&", "*", "_", "-"].sample(1) + ('0'..'9').to_a.sample(2) + ('a'..'z').to_a.sample(4)).join
|
74
|
+
end
|
71
75
|
end
|
72
76
|
end
|
73
77
|
end
|
@@ -68,12 +68,14 @@ class AuthRepository < Ibrain::BaseRepository
|
|
68
68
|
try(:gsub, '.com', '')
|
69
69
|
raise ActionController::InvalidAuthenticityToken, I18n.t('ibrain.errors.account.not_found') if uid.blank?
|
70
70
|
|
71
|
+
provider = 'custom' if user_information.try(:fetch, 'customAuth', false) && provider.blank?
|
72
|
+
|
71
73
|
collection.social_find_or_initialize({
|
72
74
|
uid: uid,
|
73
75
|
provider: provider,
|
74
76
|
remote_avatar_url: user_information.try(:fetch, 'photoUrl', nil),
|
75
77
|
email: user_information.try(:fetch, 'email', nil),
|
76
|
-
password:
|
78
|
+
password: collection.random_password
|
77
79
|
})
|
78
80
|
end
|
79
81
|
|
@@ -12,14 +12,15 @@ class FirebaseRepository < Ibrain::BaseRepository
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def generate_custom_token!
|
15
|
-
|
15
|
+
iat = Time.now.to_i
|
16
|
+
exp = 60.minutes.from_now.to_i
|
16
17
|
|
17
18
|
payload = {
|
18
19
|
iss: firebase_owner_email,
|
19
20
|
sub: firebase_owner_email,
|
20
21
|
aud: Ibrain::Auth::Config.firebase_auth_url,
|
21
|
-
iat:
|
22
|
-
exp:
|
22
|
+
iat: iat,
|
23
|
+
exp: exp,
|
23
24
|
uid: params[:uid],
|
24
25
|
claims: {}
|
25
26
|
}
|
@@ -9,8 +9,7 @@ class LineRepository < Ibrain::BaseRepository
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def find_or_initialize!
|
12
|
-
user = @collection.find_by_line(uid: params['
|
13
|
-
|
12
|
+
user = @collection.find_by_line(uid: params['code'])
|
14
13
|
return user if user.present?
|
15
14
|
|
16
15
|
@collection.create_with_line!
|
data/lib/ibrain/auth/version.rb
CHANGED
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.14
|
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: 2023-01-
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|