From 45a62b9d542473bb09aee31ab06519d13d1b1a71 Mon Sep 17 00:00:00 2001 From: _Bastler Date: Wed, 6 Oct 2021 11:21:49 +0200 Subject: [PATCH] fix --- .../bstly/board/controller/BaseController.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/main/java/de/bstly/board/controller/BaseController.java b/src/main/java/de/bstly/board/controller/BaseController.java index 17868bc..ed69071 100644 --- a/src/main/java/de/bstly/board/controller/BaseController.java +++ b/src/main/java/de/bstly/board/controller/BaseController.java @@ -55,26 +55,16 @@ public class BaseController { : null; } - /** - * Gets the local user. - * - * @return the local user - */ - protected LocalUser getLocalUser() { - return localUserManager.getByAuth(SecurityContextHolder.getContext().getAuthentication()); - } - /** * Gets the gravity. * * @return the gravity */ protected double getGravity() { - Authentication auth = SecurityContextHolder.getContext().getAuthentication(); - if (auth != null && auth.isAuthenticated()) { - LocalUser localUser = localUserManager.getByAuth(auth); - if (localUser != null && localUser.getSettings() != null - && localUser.getSettings().containsKey("gravity")) { + String username = getCurrentUsername(); + if (username != null) { + LocalUser localUser = localUserManager.getByUsername(username); + if (localUser.getSettings() != null && localUser.getSettings().containsKey("gravity")) { try { return Double.parseDouble(localUser.getSettings().get("gravity")); } catch (Exception e) {