oauth_im 0.1.1 → 0.1.2
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: 0ba9ab7f3674cc033d6ceaa2adb235c3a046f0b4090ea7d712318d8787d9abdf
|
|
4
|
+
data.tar.gz: ae1998dbd428f00ee8f2b30e334de251be35ae760b0efab820a37bc00900e7d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a87bf27fc06e740fe0b4de963d553e2d5077e55db71ce2137850fdc01bd9ee2092c600c760c788e200ef7dc0dfc0710a5961ce4b23a5310215e9cf6e4d51ff4
|
|
7
|
+
data.tar.gz: 9be6e477b2e60ad61e73e25edbc4151cbe986bb01e2125b35fb527f9c58dbbd3dd56a750492957900d539e4b0fe2312b04fd91714c580b3a9dc2d2dabc6bd188
|
|
@@ -5,7 +5,6 @@ module OauthIm
|
|
|
5
5
|
extend ActiveSupport::Concern
|
|
6
6
|
|
|
7
7
|
included do
|
|
8
|
-
before_action :auth_uid
|
|
9
8
|
helper_method :authenticated?
|
|
10
9
|
helper_method :email
|
|
11
10
|
end
|
|
@@ -20,10 +19,6 @@ module OauthIm
|
|
|
20
19
|
@email ||= jwt_token['email']
|
|
21
20
|
end
|
|
22
21
|
|
|
23
|
-
def auth_uid
|
|
24
|
-
gon.user_id = session[:user_jwt]['value'].first['jti'] if authenticated?
|
|
25
|
-
end
|
|
26
|
-
|
|
27
22
|
def user_jwt
|
|
28
23
|
@user_jwt ||= session[:user_jwt] || {}
|
|
29
24
|
end
|
|
@@ -48,7 +43,11 @@ module OauthIm
|
|
|
48
43
|
end
|
|
49
44
|
|
|
50
45
|
def logged_in?
|
|
51
|
-
current_user.present?
|
|
46
|
+
current_user.present? || local_login?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def local_login?
|
|
50
|
+
session[:userinfo].present?
|
|
52
51
|
end
|
|
53
52
|
end
|
|
54
53
|
end
|
|
@@ -21,7 +21,7 @@ module OauthIm
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def local_login
|
|
24
|
-
raise 'Disallowed'
|
|
24
|
+
raise 'Disallowed' if Rails.env.production?
|
|
25
25
|
|
|
26
26
|
session[:userinfo] = { info: { email: 'local_login@example.com' } }
|
|
27
27
|
redirect_back(fallback_location: main_app.root_path)
|
data/lib/oauth_im/version.rb
CHANGED