lol_auth 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/lol_auth/users_controller.rb +21 -9
- data/app/managers/apple/login.rb +2 -0
- data/app/managers/facebook/login.rb +2 -0
- data/app/managers/google/login.rb +2 -0
- data/app/views/lol_auth/users/error.json.jbuilder +1 -0
- data/lib/lol_auth/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe4b29b9a735ff6a60a6c87d6ec15621334fa243c95c7e80b92b7723e106ba05
|
4
|
+
data.tar.gz: b6b440b72708c5e9cadcd4b26ec6ae74b14ea517b11b0afbf637215c58fab4ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d61cb6aa55774466a8af89e30de20921668c43d8ae9effd36cb515085a0f25fa6543c8e82a5ed6dc4f57b033400c4dbba82eb858946f19fe16bcf2d21f103ec
|
7
|
+
data.tar.gz: 9bd975e38537be5fa84312cb7fcbaa63917bddae6a248a02c17813de6ed717d1e7c759640919d60c613c243318804c3d6839bf432e2ad145e24e563b44f91afd
|
@@ -9,11 +9,15 @@ module LolAuth
|
|
9
9
|
|
10
10
|
@user = @manager.login_with_token(params[:token])
|
11
11
|
|
12
|
-
|
12
|
+
if @user
|
13
|
+
sign_in(:user, @user, store: false, bypass: true)
|
13
14
|
|
14
|
-
|
15
|
+
response.headers.merge!(@manager.auth_header)
|
15
16
|
|
16
|
-
|
17
|
+
render :success, status: 201
|
18
|
+
else
|
19
|
+
render :error, status: 422
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
23
|
def apple_signin
|
@@ -21,11 +25,15 @@ module LolAuth
|
|
21
25
|
|
22
26
|
@user = @manager.process()
|
23
27
|
|
24
|
-
|
28
|
+
if @user
|
29
|
+
sign_in(:user, @user, store: false, bypass: true)
|
25
30
|
|
26
|
-
|
31
|
+
response.headers.merge!(@manager.auth_header)
|
27
32
|
|
28
|
-
|
33
|
+
render :success, status: 201
|
34
|
+
else
|
35
|
+
render :error, status: 422
|
36
|
+
end
|
29
37
|
end
|
30
38
|
|
31
39
|
def google_signin
|
@@ -33,11 +41,15 @@ module LolAuth
|
|
33
41
|
|
34
42
|
@user = @manager.process()
|
35
43
|
|
36
|
-
|
44
|
+
if @user
|
45
|
+
sign_in(:user, @user, store: false, bypass: true)
|
37
46
|
|
38
|
-
|
47
|
+
response.headers.merge!(@manager.auth_header)
|
39
48
|
|
40
|
-
|
49
|
+
render :success, status: 201
|
50
|
+
else
|
51
|
+
render :error, status: 422
|
52
|
+
end
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
data/app/managers/apple/login.rb
CHANGED
@@ -9,6 +9,8 @@ module Apple
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def process
|
12
|
+
return false if @user_type.constantize.where(email: @info['email']).where.not(provider: :apple).count > 0
|
13
|
+
|
12
14
|
user = @user_type.constantize.find_or_create_by(uid: @info['email']) do |user|
|
13
15
|
user.email = @info['email']
|
14
16
|
user.password = build_pasword()
|
@@ -9,6 +9,8 @@ module Google
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def process
|
12
|
+
return false if @user_type.constantize.where(email: @info['email']).where.not(provider: :google).count > 0
|
13
|
+
|
12
14
|
user = @user_type.constantize.find_or_create_by(uid: @info['user']['id']) do |user|
|
13
15
|
user.email = @info['user']['email']
|
14
16
|
user.password = build_pasword()
|
@@ -0,0 +1 @@
|
|
1
|
+
json.message 'REGISTERED_WHITH_OTHER_PROVIDER'
|
data/lib/lol_auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lol_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Zaghi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- app/views/lol_auth/passwords/complete.html.erb
|
215
215
|
- app/views/lol_auth/passwords/new.html.erb
|
216
216
|
- app/views/lol_auth/users/_user.json.jbuilder
|
217
|
+
- app/views/lol_auth/users/error.json.jbuilder
|
217
218
|
- app/views/lol_auth/users/success.json.jbuilder
|
218
219
|
- config/initializers/devise_token_auth.rb
|
219
220
|
- config/initializers/lol_users_config.rb
|