From bf945b4ea1a1e2a0aad5ae785bfe2732b7956e6a Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Thu, 10 Feb 2022 16:24:35 +0000 Subject: [PATCH] Follow up 0b449839ea8d90532e88eeedb5c9643cc5078f05 - Fixes #3956 - Migration of the MS365 account fails by upper and lower case differences in email address. --- lib/external_credential/google.rb | 3 +-- lib/external_credential/microsoft365.rb | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/external_credential/google.rb b/lib/external_credential/google.rb index a0d4e2d2e..a5d989fd5 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 1b2bf1a8b..56cd34688 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