From da522d8d588851bcb33af102bcd27851d52e2bad Mon Sep 17 00:00:00 2001 From: FreeScout Date: Thu, 18 Jul 2024 00:29:22 -0700 Subject: [PATCH] Fix Disconnect link for MS365 in Fetching settings - closes #4136 --- app/Mailbox.php | 6 ++++++ resources/views/mailboxes/connection_incoming.blade.php | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) 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
- + {{--@include('partials/field_error', ['field'=>'in_username'])--}}
@@ -105,7 +105,7 @@
- +

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') }})