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 | 48 | |
| 49 | 49 | def find_or_new_for_omniauth(auth) |
| 50 | 50 | provider, uid = auth.provider, auth.uid |
| 51 | + email = auth.info.email.downcase unless auth.info.email.nil? | |
| 51 | 52 | |
| 52 | 53 | if @user = User.find_by_provider_and_extern_uid(provider, uid) |
| 53 | 54 | @user |
| 55 | + elsif @user = User.find_by_email(email) | |
| 56 | + @user.update_attributes(:extern_uid => uid, :provider => provider) | |
| 57 | + @user | |
| 54 | 58 | else |
| 55 | 59 | if Gitlab.config.omniauth['allow_single_sign_on'] |
| 56 | 60 | @user = create_from_omniauth(auth) | ... | ... |