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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1864bee19a55d87f0a8298674e34cbf40f02b90f
4
- data.tar.gz: cd969ace804a59becb7931c94cf6080a5eb42c0e
3
+ metadata.gz: 856560cbb081cb688dae77144fe14e9d99fd9011
4
+ data.tar.gz: 2e45bc3bf5182b2f731696e94dc5e2093307d825
5
5
  SHA512:
6
- metadata.gz: 064e88331e2ae55481701bb5629c54d598ab457fd3fb939e4cf4d77525e3e3114c8e640c3b5d20afaeef31ec35ecccd8fdb58f1cbdc85c330b86c566d5c234a1
7
- data.tar.gz: 8fc78127eb3f92935801db32cd2eb2126fa674512d733930aea56e97ed20a80e22790c82fbd33512c1bca894bdb9d1809f2aa3f9b35923f7e55c453c5a5629ef
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).
@@ -12,6 +12,14 @@ module Identity
12
12
  omniauth_login('Google')
13
13
  end
14
14
 
15
+ def yahoo
16
+ omniauth_login('Yahoo')
17
+ end
18
+
19
+ def windowslive
20
+ omniauth_login('Microsoft')
21
+ end
22
+
15
23
  private
16
24
 
17
25
  def omniauth_login(title)
@@ -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) %><br />
23
+ <%= link_to image_tag("#{provider}.png", alt: provider.capitalize), omniauth_authorize_path(resource_name, provider) %>
24
24
  <% end -%>
25
25
  <% end -%>
@@ -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.email = auth.provider == "twitter" ? "#{auth.info.nickname}_email@example.com" : auth.info.email
18
- user.password = Devise.friendly_token[0,20]
24
+ user.build_from_auth auth
19
25
  end
20
26
  end
21
27
 
@@ -1,3 +1,3 @@
1
1
  module Identity
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
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.1
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-21 00:00:00.000000000 Z
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