anadea-identity 0.4.1 → 0.4.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 +4 -4
- data/README.md +20 -0
- data/app/assets/images/windowslive.png +0 -0
- data/app/assets/images/yahoo.png +0 -0
- data/app/controllers/identity/omniauth_callbacks_controller.rb +8 -0
- data/app/views/devise/shared/_links.erb +1 -1
- data/lib/identity/mixins/user.rb +8 -2
- data/lib/identity/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 856560cbb081cb688dae77144fe14e9d99fd9011
|
4
|
+
data.tar.gz: 2e45bc3bf5182b2f731696e94dc5e2093307d825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1b17436816726952a84a651abb35bcb0c89a2a128c80c98cd6da5efbf5892e70911caf040970ea80bbe957364eebd768da13c470e156b6bc56c80637637a9f3
|
7
|
+
data.tar.gz: 306161bbfc204ce2d7a1e998fd162b570ff58ee3d5e8eb599b9892b6ad05f143d45047d87456489f4989bdb2a7b33bf24d4c4c5388f48f5449a2b3aa30837987
|
data/README.md
CHANGED
@@ -136,3 +136,23 @@ config.parent_controller = "ApplicationController"
|
|
136
136
|
в `config/initializers/identity.rb`.
|
137
137
|
* создать приложение в Google можно [здесь](https://console.developers.google.com/project).
|
138
138
|
* для создания приложения можно воспользоваться [инструкцией](https://developers.google.com/identity/protocols/OpenIDConnect#appsetup)
|
139
|
+
* если после выполнения всех инструкций и проверки правильности 'Redirect URIs' и 'Client ID'/'Client secret', аутентификация не
|
140
|
+
происходит и выдает ошибку 'Error: redirect_uri_mismatch', то нужно пересоздать Client ID. Есть какой-то внутренний баг гема.
|
141
|
+
|
142
|
+
### Логин через Microsoft.
|
143
|
+
|
144
|
+
Для того, чтобы включить в приложении логин через Microsoft нужно:
|
145
|
+
|
146
|
+
* подключить `gem 'omniauth-windowslive'` в своем Gemfile.
|
147
|
+
* указать `config.omniauth :windowslive, ENV['MICROSOFT_KEY'], ENV['MICROSOFT_SECRET'], scope: 'wl.emails'`
|
148
|
+
в `config/initializers/identity.rb`.
|
149
|
+
* создать приложение в Microsoft можно [здесь](https://account.live.com/developers/applications).
|
150
|
+
|
151
|
+
### Логин через Yahoo.
|
152
|
+
|
153
|
+
Для того, чтобы включить в приложении логин через Yahoo нужно:
|
154
|
+
|
155
|
+
* подключить `gem 'omniauth-yahoo'` в своем Gemfile.
|
156
|
+
* указать `config.omniauth :yahoo, ENV['YAHOO_KEY'], ENV['YAHOO_SECRET']`
|
157
|
+
в `config/initializers/identity.rb`.
|
158
|
+
* создать приложение в Yahoo можно [здесь](https://developer.apps.yahoo.com/projects).
|
Binary file
|
Binary file
|
@@ -20,6 +20,6 @@
|
|
20
20
|
|
21
21
|
<%- if devise_mapping.omniauthable? %>
|
22
22
|
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
-
<%= link_to image_tag("#{provider}.png", alt: provider.capitalize), omniauth_authorize_path(resource_name, provider)
|
23
|
+
<%= link_to image_tag("#{provider}.png", alt: provider.capitalize), omniauth_authorize_path(resource_name, provider) %>
|
24
24
|
<% end -%>
|
25
25
|
<% end -%>
|
data/lib/identity/mixins/user.rb
CHANGED
@@ -11,11 +11,17 @@ module Identity
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
def build_from_auth(auth)
|
15
|
+
self.email = "#{auth.uid}@#{auth.provider}.com"
|
16
|
+
self.password = Devise.friendly_token[0,20]
|
17
|
+
|
18
|
+
send("build_from_#{auth.provider}", auth) if respond_to?("build_from_#{auth.provider}")
|
19
|
+
end
|
20
|
+
|
14
21
|
module ClassMethods
|
15
22
|
def from_omniauth!(auth)
|
16
23
|
where(provider: auth.provider, uid: auth.uid).first_or_create! do |user|
|
17
|
-
user.
|
18
|
-
user.password = Devise.friendly_token[0,20]
|
24
|
+
user.build_from_auth auth
|
19
25
|
end
|
20
26
|
end
|
21
27
|
|
data/lib/identity/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anadea-identity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anadea team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|
@@ -63,6 +63,8 @@ files:
|
|
63
63
|
- app/assets/images/facebook.png
|
64
64
|
- app/assets/images/google_oauth2.png
|
65
65
|
- app/assets/images/twitter.png
|
66
|
+
- app/assets/images/windowslive.png
|
67
|
+
- app/assets/images/yahoo.png
|
66
68
|
- app/controllers/identity/base_controller.rb
|
67
69
|
- app/controllers/identity/omniauth_callbacks_controller.rb
|
68
70
|
- app/views/devise/confirmations/new.html.erb
|