From e062d9254f3a5e349ef9f683bed290a0e42a4483 Mon Sep 17 00:00:00 2001 From: Marc Beyer Date: Tue, 11 Jan 2022 17:08:09 +0100 Subject: [PATCH] Fixed isAdmin at addNewUser endpoint --- .../java/com/vpr/server/controller/UserController.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/com/vpr/server/controller/UserController.java b/server/src/main/java/com/vpr/server/controller/UserController.java index 63d2961..5e85efe 100644 --- a/server/src/main/java/com/vpr/server/controller/UserController.java +++ b/server/src/main/java/com/vpr/server/controller/UserController.java @@ -31,7 +31,7 @@ public class UserController { @RequestParam String forename, @RequestParam String login, @RequestParam String password, - @RequestParam String isAdmin + @RequestParam Boolean isAdmin ) { byte[] salt = Hasher.GenerateSalt(); byte[] hash; @@ -50,8 +50,8 @@ public class UserController { user.setLogin(login); user.setPassword(hash); user.setSalt(salt); - user.setToken("test"); - user.setAdmin(isAdmin.equals("1")); + user.setToken(""); + user.setAdmin(isAdmin); userRepository.save(user); return "" + user.getId(); @@ -63,9 +63,10 @@ public class UserController { @RequestParam String login, @RequestParam String password ) { - System.out.println("LOGIN"); + System.out.println(login + " tries to login."); User user = userRepository.findByLogin(login); if (user == null) { + System.out.println("Login for " + login + " failed."); throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "Falscher login"); }