Skip to content
Snippets Groups Projects
Commit 2b2016eb authored by Ling Xing's avatar Ling Xing
Browse files

added ability to connect existing accounts

parent 2b756879
No related branches found
No related tags found
1 merge request!2added ability to connect existing accounts
Loading
Loading
@@ -26,9 +26,15 @@ class GitLabAuthenticator < ::Auth::Authenticator
# Plugin specific data storage
current_info = ::PluginStore.get("gl", "gl_uid_#{gl_uid}")
 
result.user =
if current_info
User.where(id: current_info[:user_id]).first
# Check if the user is trying to connect existing account
unless current_info
existing_user = User.where(email: email).first
if existing_user
::PluginStore.set("gl", "gl_uid_#{data[:gl_uid]}", {user_id: existing_user.id })
result.user = existing_user
end
else
result.user = User.where(id: current_info[:user_id]).first
end
 
result.name = name
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment