diff --git a/app/Mailbox.php b/app/Mailbox.php index 538b5fd37..2499a29ed 100644 --- a/app/Mailbox.php +++ b/app/Mailbox.php @@ -977,6 +977,12 @@ public function oauthGetParam($param) return $this->meta['oauth'][$param] ?? ''; } + public function inOauthEnabled() + { + return $this->oauthEnabled() + && $this->in_username !== null && !strstr($this->in_username, '@'); + } + public function outOauthEnabled() { return $this->oauthEnabled() diff --git a/resources/views/mailboxes/connection_incoming.blade.php b/resources/views/mailboxes/connection_incoming.blade.php index 1381cde23..87785b964 100644 --- a/resources/views/mailboxes/connection_incoming.blade.php +++ b/resources/views/mailboxes/connection_incoming.blade.php @@ -89,13 +89,13 @@ @php - $oauth_fully_enabled = ($mailbox->oauthEnabled() && strstr($mailbox->in_username, '@')); + $in_oauth_enabled = $mailbox->inOauthEnabled(); @endphp
oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT) class="text-success" @endif>Microsoft Exchange @@ -113,7 +113,7 @@ @if ($mailbox->in_username && $mailbox->in_password && !strstr($mailbox->in_username, '@')) – {{ __('Connect') }} @endif - @elseif ($mailbox->oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT && $oauth_fully_enabled) + @elseif ($mailbox->oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT && $in_oauth_enabled) – {{ __('Disconnect') }} @endif ({{ __('Help') }})