Skip to content
This repository has been archived by the owner on Dec 23, 2018. It is now read-only.

Commit

Permalink
Merge pull request #149 from coeventer/133_gh_email
Browse files Browse the repository at this point in the history
Reenabled GH auth
  • Loading branch information
pete2786 authored Mar 4, 2017
2 parents bdbba3e + 0210233 commit 589c7ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.create_with_omniauth(auth, organization=nil)
user = pu.user if pu

# 2. If 1 didn't work, attempt to find the user by auth provided email address
user = User.find_by(email: auth.info.email) if !user and auth.info.has_key?('email')
user = User.find_by(email: auth.info.email) if !user and auth.info.has_key?('email') && !auth.info.email.blank?

# 3. If 1 and 2 didn't work, assume the user doesn't exist yet.
user ||= create! do |new_user|
Expand All @@ -36,7 +36,7 @@ def self.create_with_omniauth(auth, organization=nil)
new_user.image = auth.info.image
new_user.verified = false

if auth.info.key?('email')
if auth.info.key?('email') && !auth.info.email.blank?
new_user.email = auth.info.email
# Assume the OAuth provider has confirmed the user's email address
new_user.email_confirmed = true
Expand Down
3 changes: 3 additions & 0 deletions app/views/layouts/common/_sign_in.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<%=link_to facebook_path, class: "btn btn-primary" do%>
<i class="fa fa-facebook-square"></i> Facebook Sign in
<% end %>
<%=link_to github_path, class: "btn btn-primary" do%>
<i class="fa fa-github"></i> Github Sign in
<% end %>
</p>
<p>
<%=link_to meetup_path, class: "btn btn-primary" do%>
Expand Down

0 comments on commit 589c7ef

Please sign in to comment.