diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-10-21 20:13:35 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-10-21 20:13:35 +0400 |
commit | fb903de50828ca01c533e5f02527623ff27a253b (patch) | |
tree | 97ed2a7376558e613710566e1eaf611ec3e452ca /lib | |
parent | 4e363c613680230dc8f84169f4ad9c348c9f2826 (diff) | |
parent | 054c15e7b5f9967417a0ea03aad0c4d77afd3bca (diff) |
Merge pull request #1740 from godric7/master
Enable Oauth login for existing regular users
Diffstat (limited to 'lib')
-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) |