From e8241decc705f9db3e46aed7b3a3f8b3188cf820 Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期四, 10 三月 2022 15:46:46 +0800 Subject: [PATCH] Merge branch 'Phase3' into pollex-dev --- pamapi/src/main/java/com/pollex/pam/web/rest/AccountResource.java | 62 +++++++++++++++++-------------- 1 files changed, 34 insertions(+), 28 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 fbb1b24..a808fcd 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 @@ -1,22 +1,23 @@ package com.pollex.pam.web.rest; -import com.pollex.pam.domain.User; -import com.pollex.pam.repository.UserRepository; -import com.pollex.pam.security.SecurityUtils; -import com.pollex.pam.service.MailService; -import com.pollex.pam.service.UserService; -import com.pollex.pam.service.dto.AdminUserDTO; -import com.pollex.pam.service.dto.PasswordChangeDTO; -import com.pollex.pam.web.rest.errors.*; -import com.pollex.pam.web.rest.vm.KeyAndPasswordVM; -import com.pollex.pam.web.rest.vm.ManagedUserVM; +import com.pollex.pam.business.domain.User; +import com.pollex.pam.business.repository.UserRepository; +import com.pollex.pam.business.security.SecurityUtils; +import com.pollex.pam.service.CustomerService; +import com.pollex.pam.business.service.MailService; +import com.pollex.pam.business.service.UserService; +import com.pollex.pam.business.service.dto.AdminUserDTO; +import com.pollex.pam.business.service.dto.PasswordChangeDTO; +import com.pollex.pam.business.web.errors.*; +import com.pollex.pam.business.web.vm.KeyAndPasswordVM; +import com.pollex.pam.business.web.vm.ManagedUserVM; import java.util.*; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.http.HttpStatus; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** @@ -41,29 +42,34 @@ private final MailService mailService; + @Autowired + CustomerService customerService; + public AccountResource(UserRepository userRepository, UserService userService, MailService mailService) { this.userRepository = userRepository; this.userService = userService; 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 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. -- Gitblit v1.8.0