diff options
author | Godric <godric@0x3f.fr> | 2012-10-20 00:38:07 +0300 |
---|---|---|
committer | Godric <godric@0x3f.fr> | 2012-10-20 00:38:07 +0300 |
commit | 054c15e7b5f9967417a0ea03aad0c4d77afd3bca (patch) | |
tree | 6df1e29c61992fdd8ba95490915d5c8c53cd81d7 /lib/gitlab/auth.rb | |
parent | 51ef5b929708d3ad90b6db6afbb78ee24eeb8aa1 (diff) | |
download | gitlab-ce-054c15e7b5f9967417a0ea03aad0c4d77afd3bca.tar.gz |
enable Oauth login for existing regular users
fix: https://github.com/gitlabhq/gitlabhq/issues/1620
Diffstat (limited to 'lib/gitlab/auth.rb')
-rw-r--r-- | lib/gitlab/auth.rb | 4 |
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) |