VersionFix
This commit is contained in:
@ -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());
|
||||||
|
Reference in New Issue
Block a user