registrar 0.0.3.alpha → 0.0.4.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/registrar/adapter/omni_auth.rb +15 -3
- data/lib/registrar/adapter/rails.rb +32 -0
- data/lib/registrar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed7d298c6e519757fc22a1fdf2f5773bd324988e
|
4
|
+
data.tar.gz: ec74198a299d71e6a22575bd1c22cec024a2b269
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67f803bd162d2c9da4b526df054d9f538a2dae50c7bf0719f0429a980d7f8ada2f5711779314f54c4082c9b2cf23ab49adfb99ce5376ecb73fa95562032c5e0f
|
7
|
+
data.tar.gz: 43c9cd8d02093266e7a80f598976a67b7eec93c80b9b4a91def73442b76f501f7e6fdf486d0193e343b18307e6442570e4a8f9d2fd88db25aa97ef28c9ebc287
|
@@ -40,12 +40,24 @@ module Registrar
|
|
40
40
|
|
41
41
|
def normalize_provider
|
42
42
|
{
|
43
|
-
'name' =>
|
44
|
-
'uid' =>
|
45
|
-
'access_token' =>
|
43
|
+
'name' => provider_name,
|
44
|
+
'uid' => provider_uid,
|
45
|
+
'access_token' => access_token
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
49
|
+
def provider_name
|
50
|
+
auth['provider']
|
51
|
+
end
|
52
|
+
|
53
|
+
def provider_uid
|
54
|
+
auth['uid']
|
55
|
+
end
|
56
|
+
|
57
|
+
def access_token
|
58
|
+
auth['credentials']['token']
|
59
|
+
end
|
60
|
+
|
49
61
|
def normalize_profile
|
50
62
|
auth['info'].to_hash
|
51
63
|
end
|
@@ -7,6 +7,19 @@ module Registrar
|
|
7
7
|
def self.included(klass)
|
8
8
|
klass.include InstanceMethods
|
9
9
|
klass.before_action :try_to_store_registrar_profile
|
10
|
+
|
11
|
+
klass.class_eval do
|
12
|
+
helper_method :current_profile
|
13
|
+
helper_method :current_profile?
|
14
|
+
helper_method :logged_in?
|
15
|
+
|
16
|
+
helper_method :registrar_profile
|
17
|
+
helper_method :registrar_profile?
|
18
|
+
|
19
|
+
helper_method :authentication_phase?
|
20
|
+
|
21
|
+
helper_method :presentable_authentication
|
22
|
+
end
|
10
23
|
end
|
11
24
|
|
12
25
|
module InstanceMethods
|
@@ -27,6 +40,11 @@ module Registrar
|
|
27
40
|
try_to_set_current_profile
|
28
41
|
end
|
29
42
|
|
43
|
+
def current_profile?
|
44
|
+
!!current_profile
|
45
|
+
end
|
46
|
+
alias_method :logged_in?, :current_profile?
|
47
|
+
|
30
48
|
def try_to_set_current_profile
|
31
49
|
if registrar_profile?
|
32
50
|
@current_user = build_profile(registrar_profile)
|
@@ -44,6 +62,20 @@ module Registrar
|
|
44
62
|
def build_profile(profile)
|
45
63
|
::Registrar::Profile.new(profile)
|
46
64
|
end
|
65
|
+
|
66
|
+
def authentication_phase?
|
67
|
+
params[:controller] == 'authentication' && params[:action] = 'callback'
|
68
|
+
end
|
69
|
+
|
70
|
+
def presentable_authentication
|
71
|
+
{
|
72
|
+
'env.omniauth.auth' => request.env['omniauth.auth'],
|
73
|
+
'env.registrar.auth' => request.env['registrar.auth'],
|
74
|
+
'env.registrar.profile' => request.env['registrar.profile'],
|
75
|
+
'session.registrar_profile' => registrar_profile,
|
76
|
+
'runtime.current_profile' => current_profile
|
77
|
+
}
|
78
|
+
end
|
47
79
|
end
|
48
80
|
end
|
49
81
|
end
|
data/lib/registrar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: registrar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Owiesniak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|