Skip to content

Commit

Permalink
Also log user when legacy sign in methods are used
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Dec 10, 2024
1 parent 7909495 commit 80a20c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/auth/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 80a20c0

Please sign in to comment.