|
|
@@ -82,7 +82,7 @@ public class UserService {
|
|
|
checkPhoneMessageOrThrowError(userVO.getPhone(), phoneCode);
|
|
|
|
|
|
userRepository
|
|
|
- .findByPhone(userVO.getPhone())
|
|
|
+ .findByPhoneOrUsername(userVO.getPhone(), userVO.getUsername())
|
|
|
.ifPresent(user -> {
|
|
|
throw CustomErrorException.phoneAlreadyExist();
|
|
|
});
|
|
|
@@ -95,7 +95,7 @@ public class UserService {
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = RuntimeException.class)
|
|
|
- public User resetPassword(String phone, String phoneCode, String password) {
|
|
|
+ public void resetPassword(String phone, String phoneCode, String password) {
|
|
|
checkPhoneMessageOrThrowError(phone, phoneCode);
|
|
|
|
|
|
User user = userRepository
|
|
|
@@ -107,7 +107,6 @@ public class UserService {
|
|
|
user.setPassword(passwordEncoder.encode(password));
|
|
|
User savedUser = userRepository.save(user);
|
|
|
log.debug("Reset Password for User: {}", savedUser);
|
|
|
- return savedUser;
|
|
|
}
|
|
|
|
|
|
private void checkPhoneMessageOrThrowError(String phone, String phoneCode) {
|
|
|
@@ -118,7 +117,7 @@ public class UserService {
|
|
|
|
|
|
public Long findIdByPhone(String phone) {
|
|
|
return userRepository.findByPhone(phone)
|
|
|
- .map(user -> user.getId())
|
|
|
+ .map(User::getId)
|
|
|
.orElseThrow(CustomErrorException::userIdNotFound);
|
|
|
}
|
|
|
}
|