Commit 054c15e7b5f9967417a0ea03aad0c4d77afd3bca
1 parent
51ef5b92
Exists in
master
and in
4 other branches
enable Oauth login for existing regular users
fix: https://github.com/gitlabhq/gitlabhq/issues/1620
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
lib/gitlab/auth.rb
@@ -48,9 +48,13 @@ module Gitlab | @@ -48,9 +48,13 @@ module Gitlab | ||
48 | 48 | ||
49 | def find_or_new_for_omniauth(auth) | 49 | def find_or_new_for_omniauth(auth) |
50 | provider, uid = auth.provider, auth.uid | 50 | provider, uid = auth.provider, auth.uid |
51 | + email = auth.info.email.downcase unless auth.info.email.nil? | ||
51 | 52 | ||
52 | if @user = User.find_by_provider_and_extern_uid(provider, uid) | 53 | if @user = User.find_by_provider_and_extern_uid(provider, uid) |
53 | @user | 54 | @user |
55 | + elsif @user = User.find_by_email(email) | ||
56 | + @user.update_attributes(:extern_uid => uid, :provider => provider) | ||
57 | + @user | ||
54 | else | 58 | else |
55 | if Gitlab.config.omniauth['allow_single_sign_on'] | 59 | if Gitlab.config.omniauth['allow_single_sign_on'] |
56 | @user = create_from_omniauth(auth) | 60 | @user = create_from_omniauth(auth) |