enable Oauth login for existing regular users
fix: https://github.com/gitlabhq/gitlabhq/issues/1620
This commit is contained in:
parent
51ef5b9297
commit
054c15e7b5
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue