omniauth-scaffold 0.1.29 → 0.1.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d9d857acd4b93142a14bdcd97058b8418564e415
4
+ data.tar.gz: b8a28377cd2a261b150a2639d523b1a88eed1c3a
5
+ SHA512:
6
+ metadata.gz: db6bb64e74906087ce75c2bfcc53d651fafed40b538842d2be7a867f57dd2b54491b2f240e3f9040bee2675195b67eff0b3cfd7e28a000128877154aeab31f56
7
+ data.tar.gz: 2ff2947c978993971df62e7ebf8771af2073c49c5db0a03b8b2a90a0f995fe4da41a349131b0038f0ad1db39311b4be1aa37580f61b5741dbe15ceb60323ed35
@@ -6,6 +6,8 @@ class CreateUsers < ActiveRecord::Migration
6
6
  t.string :name
7
7
  t.string :nickname
8
8
  t.string :image
9
+ t.string :email
10
+ t.string :location
9
11
  t.string :token
10
12
  t.string :secret
11
13
 
@@ -9,3 +9,6 @@ facebook_app_secret: <%= ENV['FACEBOOK_APP_SECRET'] %>
9
9
  # GitHub OAuth Setting
10
10
  github_client_id: <%= ENV['GITHUB_CLIENT_ID'] %>
11
11
  github_secret: <%= ENV['GITHUB_SECRET'] %>
12
+
13
+ # Gmail Pass
14
+ mail_password: <%= ENV['MAIL_PASSWORD'] %>
@@ -5,7 +5,10 @@ class SessionsController < ApplicationController
5
5
  #----------#
6
6
  def callback
7
7
  auth = request.env["omniauth.auth"]
8
+
8
9
  user = User.where( provider: auth["provider"], uid: auth["uid"] ).first || User.create_with_omniauth( auth )
10
+ user.auth_update( auth )
11
+
9
12
  session[:user_id] = user.id
10
13
 
11
14
  # 保管URLへリダイレクト
@@ -1,6 +1,22 @@
1
1
  # coding: utf-8
2
2
  class User < ActiveRecord::Base
3
- attr_accessible :provider, :uid, :name, :nickname, :image, :token, :secret
3
+ attr_accessible :provider, :uid, :name, :nickname, :image, :email, :location, :token, :secret
4
+
5
+ #-------------#
6
+ # auth_update #
7
+ #-------------#
8
+ def auth_update( auth )
9
+ image_path = "https://graph.facebook.com/#{auth['info']['nickname'].presence || auth["uid"]}/picture?width=200&height=200"
10
+
11
+ if self.name != auth["info"]["name"] or self.nickname != auth["info"]["nickname"] or self.image != image_path or self.email != auth["info"]["email"] or self.location != auth["info"]["location"]
12
+ self.name = auth["info"]["name"]
13
+ self.nickname = auth["info"]["nickname"]
14
+ self.image = image_path
15
+ self.email = auth["info"]["email"]
16
+ self.location = auth["info"]["location"]
17
+ self.save!
18
+ end
19
+ end
4
20
 
5
21
  private
6
22
 
@@ -16,6 +32,8 @@ class User < ActiveRecord::Base
16
32
  user.name = auth["info"]["name"]
17
33
  user.nickname = auth["info"]["nickname"]
18
34
  user.image = auth["info"]["image"]
35
+ user.email = auth["info"]["email"]
36
+ user.location = auth["info"]["location"]
19
37
  end
20
38
 
21
39
  unless auth["credentials"].blank?
@@ -23,7 +41,7 @@ class User < ActiveRecord::Base
23
41
  user.secret = auth['credentials']['secret']
24
42
  end
25
43
 
26
- user.save
44
+ user.save!
27
45
 
28
46
  return user
29
47
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Scaffold
3
- VERSION = "0.1.29"
3
+ VERSION = "0.1.30"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.29
5
- prerelease:
4
+ version: 0.1.30
6
5
  platform: ruby
7
6
  authors:
8
7
  - shu0115
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-16 00:00:00.000000000 Z
11
+ date: 2013-03-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails_config
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: omniauth-twitter
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: omniauth-facebook
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: omniauth-github
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: tapp
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: awesome_print
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  description: Scaffold for OmniAuth.
@@ -145,27 +132,25 @@ files:
145
132
  - omniauth-scaffold.gemspec
146
133
  homepage: https://github.com/shu0115/omniauth-scaffold
147
134
  licenses: []
135
+ metadata: {}
148
136
  post_install_message:
149
137
  rdoc_options: []
150
138
  require_paths:
151
139
  - lib
152
140
  required_ruby_version: !ruby/object:Gem::Requirement
153
- none: false
154
141
  requirements:
155
- - - ! '>='
142
+ - - '>='
156
143
  - !ruby/object:Gem::Version
157
144
  version: '0'
158
145
  required_rubygems_version: !ruby/object:Gem::Requirement
159
- none: false
160
146
  requirements:
161
- - - ! '>='
147
+ - - '>='
162
148
  - !ruby/object:Gem::Version
163
149
  version: '0'
164
150
  requirements: []
165
151
  rubyforge_project:
166
- rubygems_version: 1.8.23
152
+ rubygems_version: 2.0.0
167
153
  signing_key:
168
- specification_version: 3
154
+ specification_version: 4
169
155
  summary: OmniAuth Scaffold
170
156
  test_files: []
171
- has_rdoc: