From 80a20c08db6a3de8daee5fdea7a8b845c3d0ee68 Mon Sep 17 00:00:00 2001 From: "jorg.vr" Date: Tue, 10 Dec 2024 13:15:26 +0100 Subject: [PATCH] Also log user when legacy sign in methods are used --- app/controllers/auth/omniauth_callbacks_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/auth/omniauth_callbacks_controller.rb b/app/controllers/auth/omniauth_callbacks_controller.rb index 815b0cd499..7209241923 100644 --- a/app/controllers/auth/omniauth_callbacks_controller.rb +++ b/app/controllers/auth/omniauth_callbacks_controller.rb @@ -235,7 +235,7 @@ def find_identity_by_uid identity = Identity.joins(:user).find_by(user: { first_name: auth_hash.info.first_name, last_name: auth_hash.info.last_name }, provider: provider, identifier_based_on_email: true) if identity.nil? return nil if identity.nil? - Event.new(event_type: :other, message: 'Office365 user signed in with legacy identifier').save! + Event.new(event_type: :other, message: 'Office365 user signed in with legacy identifier', user: identity.user).save! # Update the identifier to the new uid identity.update(identifier: auth_uid, identifier_based_on_email: false) @@ -251,7 +251,7 @@ def find_identity_by_uid identity = Identity.joins(:user).find_by(user: { first_name: auth_hash.info.first_name, last_name: auth_hash.info.last_name }, provider: provider, identifier_based_on_username: true) if identity.nil? return nil if identity.nil? - Event.new(event_type: :other, message: 'Smartschool user signed in with legacy identifier').save! + Event.new(event_type: :other, message: 'Smartschool user signed in with legacy identifier', user: identity.user).save! # Update the identifier to the new uid identity.update(identifier: auth_uid, identifier_based_on_username: false)