From 104c8b890dbca25a0d08b2567d003f02953a0fc1 Mon Sep 17 00:00:00 2001 From: James Edwards-Jones Date: Sat, 8 Dec 2018 14:12:50 +0000 Subject: Backport EE GroupSAML origin verification changes --- lib/gitlab/auth/omniauth_identity_linker_base.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/gitlab/auth/omniauth_identity_linker_base.rb b/lib/gitlab/auth/omniauth_identity_linker_base.rb index 253445570f2..c620fc5d6bd 100644 --- a/lib/gitlab/auth/omniauth_identity_linker_base.rb +++ b/lib/gitlab/auth/omniauth_identity_linker_base.rb @@ -12,7 +12,7 @@ module Gitlab end def link - save if identity.new_record? + save if unlinked? end def changed? @@ -35,6 +35,10 @@ module Gitlab @changed = identity.save end + def unlinked? + identity.new_record? + end + # rubocop: disable CodeReuse/ActiveRecord def identity @identity ||= current_user.identities -- cgit v1.2.3