Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.example.domain.member.service;

import java.util.Optional;
import java.util.regex.Pattern;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.api_response.exception.GeneralException;
Expand Down Expand Up @@ -84,7 +85,8 @@ public void validateHandle(ValidateHandleRequest request) {
}

ResponseEntity<String> response = HttpRequest.getRequest(Url.BAEKJOON_USER.getBaekjoonUserUrl(request.handle()), String.class);
if (!response.getStatusCode().is2xxSuccessful()) {
if (!Pattern.compile("^[A-Za-z0-9_]{3,20}$").matcher(request.handle()).matches() ||
!response.getStatusCode().is2xxSuccessful()) {
throw new GeneralException(ErrorStatus.BAD_REQUEST, "백준 닉네임이 유효하지 않습니다.");
}
}
Expand Down
Loading