From e61e8011480ec372d9c89540128e1ce48905e284 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 9 Feb 2024 14:38:32 +0100 Subject: [PATCH] Prevent different identities from a same SSO provider from accessing a same account --- app/models/concerns/omniauthable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/concerns/omniauthable.rb b/app/models/concerns/omniauthable.rb index 3983fbcda8..eb3b8efa54 100644 --- a/app/models/concerns/omniauthable.rb +++ b/app/models/concerns/omniauthable.rb @@ -51,7 +51,7 @@ module Omniauthable user = User.find_by(email: email) if email_is_verified - return user unless user.nil? + return user unless user.nil? && !Identity.exists?(provider: auth.provider, user_id: user.id) user = User.new(user_params_from_auth(email, auth))