Compare commits

..

2 Commits

Author SHA1 Message Date
a663a73ff1 修正邮箱格式 2025-05-20 10:46:49 +09:00
2d27ebea35 VersionFix 2025-05-19 16:11:44 +09:00
2 changed files with 2 additions and 10 deletions

View File

@ -1,7 +1,7 @@
package co.jp.app.dto; package co.jp.app.dto;
import jakarta.validation.constraints.Email; import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank; // 或 javax.validation.constraints.NotBlank import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern; import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;

View File

@ -31,16 +31,10 @@ 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())) { if (userRepository.existsByEmail(registrationDto.getEmail())) {
throw new BusinessException(ResultCode.USER_USERNAME_ALREADY_EXISTS,"error: Name" + registrationDto.getName() + " had been used"); throw new BusinessException(ResultCode.USER_EMAIL_ALREADY_EXISTS,"error: Email" + registrationDto.getEmail() + " 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();
@ -51,8 +45,6 @@ public class UserService implements UserDetailsService {
return userRepository.save(newUser); return userRepository.save(newUser);
} }
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {