Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGodric <godric@0x3f.fr>2012-10-20 01:38:07 +0400
committerGodric <godric@0x3f.fr>2012-10-20 01:38:07 +0400
commit054c15e7b5f9967417a0ea03aad0c4d77afd3bca (patch)
tree6df1e29c61992fdd8ba95490915d5c8c53cd81d7
parent51ef5b929708d3ad90b6db6afbb78ee24eeb8aa1 (diff)
enable Oauth login for existing regular users
fix: https://github.com/gitlabhq/gitlabhq/issues/1620
-rw-r--r--lib/gitlab/auth.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
index 500cb64df48..5a24c5d01b5 100644
--- a/lib/gitlab/auth.rb
+++ b/lib/gitlab/auth.rb
@@ -48,9 +48,13 @@ module Gitlab
def find_or_new_for_omniauth(auth)
provider, uid = auth.provider, auth.uid
+ email = auth.info.email.downcase unless auth.info.email.nil?
if @user = User.find_by_provider_and_extern_uid(provider, uid)
@user
+ elsif @user = User.find_by_email(email)
+ @user.update_attributes(:extern_uid => uid, :provider => provider)
+ @user
else
if Gitlab.config.omniauth['allow_single_sign_on']
@user = create_from_omniauth(auth)