X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/b4f2b735904169eb12a05cb0befc4ff38beaeaee..refs/pull/1908/head:/app/Http/Controllers/SettingController.php diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 7f7724468..00dd60ac7 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -71,7 +71,8 @@ class SettingController extends Controller } $this->showSuccessNotification(trans('settings.settings_save_success')); - return redirect('/settings#' . $request->get('section', '')); + $redirectLocation = '/settings#' . $request->get('section', ''); + return redirect(rtrim($redirectLocation, '#')); } /** @@ -121,8 +122,14 @@ class SettingController extends Controller { $this->checkPermission('settings-manage'); - user()->notify(new TestEmail()); - $this->showSuccessNotification(trans('settings.maint_send_test_email_success', ['address' => user()->email])); + try { + user()->notify(new TestEmail()); + $this->showSuccessNotification(trans('settings.maint_send_test_email_success', ['address' => user()->email])); + } catch (\Exception $exception) { + $errorMessage = trans('errors.maintenance_test_email_failure') . "\n" . $exception->getMessage(); + $this->showErrorNotification($errorMessage); + } + return redirect('/settings/maintenance#image-cleanup')->withInput(); }