diff --git a/lib/external_credential/google.rb b/lib/external_credential/google.rb index e141e2e24..b97207a7c 100644 --- a/lib/external_credential/google.rb +++ b/lib/external_credential/google.rb @@ -85,10 +85,9 @@ class ExternalCredential::Google migrate_channel = nil Channel.where(area: 'Email::Account').find_each do |channel| - next if channel.options.dig(:inbound, :options, :user)&.downcase != user_data[:email].downcase next if channel.options.dig(:inbound, :options, :host)&.downcase != 'imap.gmail.com' - next if channel.options.dig(:outbound, :options, :user)&.downcase != user_data[:email].downcase next if channel.options.dig(:outbound, :options, :host)&.downcase != 'smtp.gmail.com' + next if channel.options.dig(:outbound, :options, :user)&.downcase != user_data[:email].downcase && channel.options.dig(:outbound, :email)&.downcase != user_data[:email].downcase migrate_channel = channel diff --git a/lib/external_credential/microsoft365.rb b/lib/external_credential/microsoft365.rb index f89172d7b..922583c3b 100644 --- a/lib/external_credential/microsoft365.rb +++ b/lib/external_credential/microsoft365.rb @@ -89,10 +89,9 @@ class ExternalCredential::Microsoft365 migrate_channel = nil Channel.where(area: 'Email::Account').find_each do |channel| - next if channel.options.dig(:inbound, :options, :user)&.downcase != user_data[:email].downcase next if channel.options.dig(:inbound, :options, :host)&.downcase != 'outlook.office365.com' - next if channel.options.dig(:outbound, :options, :user)&.downcase != user_data[:email].downcase next if channel.options.dig(:outbound, :options, :host)&.downcase != 'smtp.office365.com' + next if channel.options.dig(:outbound, :options, :user)&.downcase != user_data[:email].downcase && channel.options.dig(:outbound, :email)&.downcase != user_data[:email].downcase migrate_channel = channel