修正邮箱格式
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
package co.jp.app.dto;
|
||||
|
||||
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.Size;
|
||||
|
||||
|
@ -33,6 +33,10 @@ public class UserService implements UserDetailsService {
|
||||
|
||||
public UserEntity registerNewUser(@NotNull RegistrationDto registrationDto) throws BusinessException {
|
||||
|
||||
if (userRepository.existsByEmail(registrationDto.getEmail())) {
|
||||
throw new BusinessException(ResultCode.USER_EMAIL_ALREADY_EXISTS,"error: Email" + registrationDto.getEmail() + " had been used");
|
||||
}
|
||||
|
||||
UserEntity newUser = new UserEntity();
|
||||
newUser.setName(registrationDto.getName());
|
||||
newUser.setEmail(registrationDto.getEmail());
|
||||
@ -40,8 +44,6 @@ public class UserService implements UserDetailsService {
|
||||
|
||||
return userRepository.save(newUser);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
|
Reference in New Issue
Block a user