From d8cf7e81b9d338976178030b73a48095437f573a Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 13 Jan 2024 00:55:43 +0000 Subject: [PATCH] fixes --- build.gradle | 2 +- .../SPDF/controller/api/UserController.java | 13 +++++-------- .../software/SPDF/model/api/user/Username.java | 2 -- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index ebd73077..32922021 100644 --- a/build.gradle +++ b/build.gradle @@ -165,7 +165,7 @@ tasks.withType(JavaCompile) { dependsOn 'spotlessApply' } compileJava { - options.compilerArgs << ' -parameters' + options.compilerArgs << '-parameters' } task writeVersion { diff --git a/src/main/java/stirling/software/SPDF/controller/api/UserController.java b/src/main/java/stirling/software/SPDF/controller/api/UserController.java index a27c8331..ce15d19c 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/UserController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/UserController.java @@ -28,7 +28,6 @@ import jakarta.servlet.http.HttpServletResponse; import stirling.software.SPDF.config.security.UserService; import stirling.software.SPDF.model.Role; import stirling.software.SPDF.model.User; -import stirling.software.SPDF.model.api.misc.OptimizePdfRequest; import stirling.software.SPDF.model.api.user.UpdateUserDetails; import stirling.software.SPDF.model.api.user.UsernameAndPass; @@ -41,8 +40,7 @@ public class UserController { @PreAuthorize("!hasAuthority('ROLE_DEMO_USER')") @PostMapping("/register") - public String register( - @ModelAttribute UsernameAndPass requestModel, Model model) { + public String register(@ModelAttribute UsernameAndPass requestModel, Model model) { if (userService.usernameExists(requestModel.getUsername())) { model.addAttribute("error", "Username already exists"); return "register"; @@ -61,11 +59,10 @@ public class UserController { HttpServletResponse response, RedirectAttributes redirectAttributes) { - - String currentPassword = requestModel.getPassword(); - String newPassword = requestModel.getNewPassword(); - String newUsername = requestModel.getNewUsername(); - + String currentPassword = requestModel.getPassword(); + String newPassword = requestModel.getNewPassword(); + String newUsername = requestModel.getNewUsername(); + if (principal == null) { return new RedirectView("/change-creds?messageType=notAuthenticated"); } diff --git a/src/main/java/stirling/software/SPDF/model/api/user/Username.java b/src/main/java/stirling/software/SPDF/model/api/user/Username.java index 3460745d..167df1b1 100644 --- a/src/main/java/stirling/software/SPDF/model/api/user/Username.java +++ b/src/main/java/stirling/software/SPDF/model/api/user/Username.java @@ -1,7 +1,5 @@ package stirling.software.SPDF.model.api.user; -import org.springframework.web.multipart.MultipartFile; - import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data;