Merge branch 'Be/user' into 'backend'
[Back-End] feat : 이메일 중복 체크 추가 See merge request s11-webmobile1-sub2/S11P12A701!78
This commit is contained in:
commit
b6672b9fa3
@ -37,6 +37,9 @@ public class UserController {
|
|||||||
if (userService.isUserIdExist(requestJoinDto.getUserId()))
|
if (userService.isUserIdExist(requestJoinDto.getUserId()))
|
||||||
return new ResponseEntity<>("아이디가 중복 됐습니다.", HttpStatus.CONFLICT);
|
return new ResponseEntity<>("아이디가 중복 됐습니다.", HttpStatus.CONFLICT);
|
||||||
|
|
||||||
|
if(userService.isEmailExist(requestJoinDto.getEmail()))
|
||||||
|
return new ResponseEntity<>("이메일이 중복 됐습니다.", HttpStatus.CONFLICT);
|
||||||
|
|
||||||
userService.join(requestJoinDto);
|
userService.join(requestJoinDto);
|
||||||
|
|
||||||
return ResponseEntity.ok("User registered successfully");
|
return ResponseEntity.ok("User registered successfully");
|
||||||
|
@ -31,4 +31,5 @@ public interface UserRepository extends JpaRepository<User,Long> {
|
|||||||
|
|
||||||
Optional<User> findByUserId(String userId);
|
Optional<User> findByUserId(String userId);
|
||||||
|
|
||||||
|
Optional<User> findByEmail(String email);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,6 @@ public interface UserService {
|
|||||||
void changePassword(PasswordDto passwordDto,Long id);
|
void changePassword(PasswordDto passwordDto,Long id);
|
||||||
|
|
||||||
boolean isUserIdExist(String userId);
|
boolean isUserIdExist(String userId);
|
||||||
|
|
||||||
|
boolean isEmailExist(String email);
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,11 @@ public class UserServiceImpl implements UserService {
|
|||||||
return userRepository.findByUserId(userId).isPresent();
|
return userRepository.findByUserId(userId).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmailExist(String email) {
|
||||||
|
return userRepository.findByEmail(email).isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
public String getTempPassword() {
|
public String getTempPassword() {
|
||||||
char[] charSet = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
|
char[] charSet = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
|
||||||
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
|
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
|
||||||
|
Loading…
Reference in New Issue
Block a user