VersionFix

This commit is contained in:
2025-05-19 16:11:44 +09:00
parent d8b7943646
commit 2d27ebea35

View File

@ -31,18 +31,8 @@ public class UserService implements UserDetailsService {
this.passwordEncoder = passwordEncoder; this.passwordEncoder = passwordEncoder;
} }
public UserEntity registerNewUser(@NotNull RegistrationDto registrationDto) throws BusinessException { public UserEntity registerNewUser(@NotNull RegistrationDto registrationDto) throws BusinessException {
if (userRepository.existsByEmail(registrationDto.getEmail())) {
throw new BusinessException(ResultCode.USER_USERNAME_ALREADY_EXISTS,"error: Name" + registrationDto.getName() + " had been used");
}
//密码最短6位限制
if (registrationDto.getPassword() == null || registrationDto.getPassword().length() < 6) {
throw new BusinessException(ResultCode.USER_PASSWORD_TOO_SHORT);
}
UserEntity newUser = new UserEntity(); UserEntity newUser = new UserEntity();
newUser.setName(registrationDto.getName()); newUser.setName(registrationDto.getName());
newUser.setEmail(registrationDto.getEmail()); newUser.setEmail(registrationDto.getEmail());