Skip to content

Commit

Permalink
Merge pull request #5995 from dodona-edu/chore/improve-sign-in-logging
Browse files Browse the repository at this point in the history
Also log user when legacy sign in methods are used
  • Loading branch information
jorg-vr authored Dec 10, 2024
2 parents 4c2d612 + 80a20c0 commit d28dffe
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 d28dffe

Please sign in to comment.