diff --git a/app/Http/Controllers/Admin/Settings/MailController.php b/app/Http/Controllers/Admin/Settings/MailController.php index b84523142..7364a4ec5 100644 --- a/app/Http/Controllers/Admin/Settings/MailController.php +++ b/app/Http/Controllers/Admin/Settings/MailController.php @@ -5,7 +5,7 @@ namespace Pterodactyl\Http\Controllers\Admin\Settings; use Exception; use Illuminate\View\View; use Illuminate\Http\Request; -use Illuminate\Http\RedirectResponse; +use Illuminate\Http\Response; use Prologue\Alerts\AlertsMessageBag; use Illuminate\Contracts\Console\Kernel; use Pterodactyl\Notifications\MailTested; @@ -85,13 +85,13 @@ class MailController extends Controller * Handle request to update SMTP mail settings. * * @param \Pterodactyl\Http\Requests\Admin\Settings\MailSettingsFormRequest $request - * @return \Illuminate\Http\RedirectResponse + * @return \Illuminate\Http\Response * * @throws DisplayException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function update(MailSettingsFormRequest $request): RedirectResponse + public function update(MailSettingsFormRequest $request): Response { if ($this->config->get('mail.driver') !== 'smtp') { throw new DisplayException('This feature is only available if SMTP is the selected email driver for the Panel.'); @@ -111,30 +111,25 @@ class MailController extends Controller } $this->kernel->call('queue:restart'); - $this->alert->success('Mail settings have been updated successfully and the queue worker was restarted to apply these changes.')->flash(); - return redirect()->route('admin.settings.mail'); + return response('', 204); } /** * Submit a request to send a test mail message. * * @param Request $request - * @return \Illuminate\Http\RedirectResponse + * @return \Illuminate\Http\Response */ - public function test(Request $request): RedirectResponse + public function test(Request $request): Response { try { Notification::route('mail', $request->user()->email) ->notify(new MailTested($request->user())); } catch (Exception $exception) { - $this->alert->danger(trans('base.mail.test_failed') . ' ' . $exception->getMessage())->flash(); - - return redirect()->route('admin.settings.mail'); + return response($exception->getMessage(), 500); } - $this->alert->success(trans('base.mail.test_succeeded'))->flash(); - - return redirect()->route('admin.settings.mail'); + return response('', 204); } } diff --git a/resources/themes/pterodactyl/admin/settings/mail.blade.php b/resources/themes/pterodactyl/admin/settings/mail.blade.php index f439634c6..3afacd783 100644 --- a/resources/themes/pterodactyl/admin/settings/mail.blade.php +++ b/resources/themes/pterodactyl/admin/settings/mail.blade.php @@ -32,7 +32,7 @@ @else -
+
@@ -99,8 +99,8 @@ @@ -109,3 +109,82 @@
@endsection + +@section('footer-scripts') + {!! Theme::js('js/laroute.js?t={cache-version}') !!} + {!! Theme::js('vendor/jquery/jquery.min.js?t={cache-version}') !!} + {!! Theme::js('vendor/sweetalert/sweetalert.min.js?t={cache-version}') !!} + + +@endsection