Skip to content

Commit

Permalink
Fix Disconnect link for MS365 in Fetching settings - closes #4136
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Jul 18, 2024
1 parent 60ac03d commit da522d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions app/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions resources/views/mailboxes/connection_incoming.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@
</div>
</div>
@php
$oauth_fully_enabled = ($mailbox->oauthEnabled() && strstr($mailbox->in_username, '@'));
$in_oauth_enabled = $mailbox->inOauthEnabled();
@endphp
<div class="form-group{{ $errors->has('in_username') ? ' has-error' : '' }}">
<label for="in_username" class="col-sm-2 control-label">{{ __('Username') }}</label>

<div class="col-sm-6">
<input id="in_username" type="text" class="form-control input-sized @if ($oauth_fully_enabled) disabled @endif" name="in_username" value="{{ old('in_username', $mailbox->in_username) }}" maxlength="100" {{-- This added to prevent autocomplete in Chrome --}}autocomplete="new-password" @if ($oauth_fully_enabled) readonly @endif >
<input id="in_username" type="text" class="form-control input-sized @if ($in_oauth_enabled) disabled @endif" name="in_username" value="{{ old('in_username', $mailbox->in_username) }}" maxlength="100" {{-- This added to prevent autocomplete in Chrome --}}autocomplete="new-password" @if ($in_oauth_enabled) readonly @endif >

{{--@include('partials/field_error', ['field'=>'in_username'])--}}
</div>
Expand All @@ -105,15 +105,15 @@
<label for="in_password" class="col-sm-2 control-label">{{ __('Password') }}</label>

<div class="col-sm-6">
<input id="in_password" type="password" class="form-control input-sized @if ($oauth_fully_enabled) disabled @endif" name="in_password" value="{{ old('in_password', $mailbox->inPasswordSafe()) }}" maxlength="255" {{-- This added to prevent autocomplete in Chrome --}}autocomplete="new-password" @if ($oauth_fully_enabled) readonly @endif>
<input id="in_password" type="password" class="form-control input-sized @if ($in_oauth_enabled) disabled @endif" name="in_password" value="{{ old('in_password', $mailbox->inPasswordSafe()) }}" maxlength="255" {{-- This added to prevent autocomplete in Chrome --}}autocomplete="new-password" @if ($in_oauth_enabled) readonly @endif>

<p class="form-help">
<small @if ($mailbox->oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT) class="text-success" @endif>Microsoft Exchange</small>
@if (!$mailbox->oauthEnabled())
@if ($mailbox->in_username && $mailbox->in_password && !strstr($mailbox->in_username, '@'))
– <a href="{{ route('mailboxes.oauth', ['id' => $mailbox->id, 'provider' => \MailHelper::OAUTH_PROVIDER_MICROSOFT, 'in_out' => 'in']) }}" target="_blank">{{ __('Connect') }}</a>
@endif
@elseif ($mailbox->oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT && $oauth_fully_enabled)
@elseif ($mailbox->oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT && $in_oauth_enabled)
– <a href="{{ route('mailboxes.oauth_disconnect', ['id' => $mailbox->id, 'provider' => \MailHelper::OAUTH_PROVIDER_MICROSOFT, 'in_out' => 'in']) }}">{{ __('Disconnect') }}</a>
@endif
<small>(<a href="{{ config('app.freescout_repo') }}/wiki/Connect-FreeScout-to-Microsoft-365-Exchange-via-oAuth" target="_blank">{{ __('Help') }}</a>)</small>
Expand Down

0 comments on commit da522d8

Please sign in to comment.