]> BookStack Code Mirror - bookstack/blobdiff - app/Users/Controllers/UserPreferencesController.php
Fixed OIDC Logout
[bookstack] / app / Users / Controllers / UserPreferencesController.php
index 999115e7b126592b81cf915514693cf91a73983e..503aeaeb0c9d23032746cf72fd67634678f2aa43 100644 (file)
@@ -17,6 +17,14 @@ class UserPreferencesController extends Controller
     ) {
     }
 
+    /**
+     * Show the overview for user preferences.
+     */
+    public function index()
+    {
+        return view('users.preferences.index');
+    }
+
     /**
      * Show the user-specific interface shortcuts.
      */
@@ -25,6 +33,8 @@ class UserPreferencesController extends Controller
         $shortcuts = UserShortcutMap::fromUserPreferences();
         $enabled = setting()->getForCurrentUser('ui-shortcuts-enabled', false);
 
+        $this->setPageTitle(trans('preferences.shortcuts_interface'));
+
         return view('users.preferences.shortcuts', [
             'shortcuts' => $shortcuts,
             'enabled' => $enabled,
@@ -53,12 +63,16 @@ class UserPreferencesController extends Controller
      */
     public function showNotifications(PermissionApplicator $permissions)
     {
+        $this->checkPermission('receive-notifications');
+        $this->preventGuestAccess();
+
         $preferences = (new UserNotificationPreferences(user()));
 
         $query = Watch::query()->where('user_id', '=', user()->id);
         $query = $permissions->restrictEntityRelationQuery($query, 'watches', 'watchable_id', 'watchable_type');
         $watches = $query->with('watchable')->paginate(20);
 
+        $this->setPageTitle(trans('preferences.notifications'));
         return view('users.preferences.notifications', [
             'preferences' => $preferences,
             'watches' => $watches,
@@ -70,6 +84,8 @@ class UserPreferencesController extends Controller
      */
     public function updateNotifications(Request $request)
     {
+        $this->checkPermission('receive-notifications');
+        $this->preventGuestAccess();
         $data = $this->validate($request, [
            'preferences' => ['required', 'array'],
            'preferences.*' => ['required', 'string'],