From c7d2507f633ee276abe6e5ff34bc4667b4274a52 Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期二, 26 四月 2022 14:52:40 +0800 Subject: [PATCH] [update] 修正弱掃 --- pamapi/src/main/java/com/pollex/pam/web/rest/AccountResource.java | 38 -------------------------------------- pamapi/src/test/java/com/pollex/pam/web/rest/AccountResourceIT.java | 4 ++-- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/pamapi/src/main/java/com/pollex/pam/web/rest/AccountResource.java b/pamapi/src/main/java/com/pollex/pam/web/rest/AccountResource.java index a808fcd..50319a9 100644 --- a/pamapi/src/main/java/com/pollex/pam/web/rest/AccountResource.java +++ b/pamapi/src/main/java/com/pollex/pam/web/rest/AccountResource.java @@ -51,26 +51,6 @@ this.mailService = mailService; } -// /** -// * {@code POST /register} : register the user. -// * -// * @param managedUserVM the managed user View Model. -// * @throws InvalidPasswordException {@code 400 (Bad Request)} if the password is incorrect. -// * @throws EmailAlreadyUsedException {@code 400 (Bad Request)} if the email is already used. -// * @throws LoginAlreadyUsedException {@code 400 (Bad Request)} if the login is already used. -// */ -// @PostMapping("/register") -// @ResponseStatus(HttpStatus.CREATED) -// public void registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) { -// if (isPasswordLengthInvalid(managedUserVM.getPassword())) { -// throw new InvalidPasswordException(); -// } -// User user = userService.registerUser(managedUserVM, managedUserVM.getPassword()); -// mailService.sendActivationEmail(user); -// } - - - /** * {@code GET /activate} : activate the registered user. * @@ -140,12 +120,6 @@ ); } - /** - * {@code POST /account/change-password} : changes the current user's password. - * - * @param passwordChangeDto current and new password. - * @throws InvalidPasswordException {@code 400 (Bad Request)} if the new password is incorrect. - */ @PostMapping(path = "/account/change-password") public void changePassword(@RequestBody PasswordChangeDTO passwordChangeDto) { if (isPasswordLengthInvalid(passwordChangeDto.getNewPassword())) { @@ -154,11 +128,6 @@ userService.changePassword(passwordChangeDto.getCurrentPassword(), passwordChangeDto.getNewPassword()); } - /** - * {@code POST /account/reset-password/init} : Send an email to reset the password of the user. - * - * @param mail the mail of the user. - */ @PostMapping(path = "/account/reset-password/init") public void requestPasswordReset(@RequestBody String mail) { Optional<User> user = userService.requestPasswordReset(mail); @@ -171,13 +140,6 @@ } } - /** - * {@code POST /account/reset-password/finish} : Finish to reset the password of the user. - * - * @param keyAndPassword the generated key and the new password. - * @throws InvalidPasswordException {@code 400 (Bad Request)} if the password is incorrect. - * @throws RuntimeException {@code 500 (Internal Server Error)} if the password could not be reset. - */ @PostMapping(path = "/account/reset-password/finish") public void finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) { if (isPasswordLengthInvalid(keyAndPassword.getNewPassword())) { diff --git a/pamapi/src/test/java/com/pollex/pam/web/rest/AccountResourceIT.java b/pamapi/src/test/java/com/pollex/pam/web/rest/AccountResourceIT.java index eace069..4773224 100644 --- a/pamapi/src/test/java/com/pollex/pam/web/rest/AccountResourceIT.java +++ b/pamapi/src/test/java/com/pollex/pam/web/rest/AccountResourceIT.java @@ -182,7 +182,7 @@ void testRegisterInvalidPassword() throws Exception { ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin("bob"); - invalidUser.setPassword("123"); // password with only 3 digits + invalidUser.setPassword("123"); invalidUser.setFirstName("Bob"); invalidUser.setLastName("Green"); invalidUser.setEmail("bob@example.com"); @@ -204,7 +204,7 @@ void testRegisterNullPassword() throws Exception { ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin("bob"); - invalidUser.setPassword(null); // invalid null password + invalidUser.setPassword(null); invalidUser.setFirstName("Bob"); invalidUser.setLastName("Green"); invalidUser.setEmail("bob@example.com"); -- Gitblit v1.8.0