]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/SettingController.php
added api functionality to handle book Shelves
[bookstack] / app / Http / Controllers / SettingController.php
index 7f7724468214101cbc443cdee63800d8cbc886e7..00dd60ac759b5a005522c2e7b2b504a36bfa9107 100644 (file)
@@ -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();
     }