Commit 054c15e7 authored by Godric's avatar Godric

enable Oauth login for existing regular users

fix: https://github.com/gitlabhq/gitlabhq/issues/1620
parent 51ef5b92
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment