Commit fb903de5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #1740 from godric7/master

Enable Oauth login for existing regular users
parents 4e363c61 054c15e7
......@@ -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