Skip to content

Commit

Permalink
fix: 패턴, 최소/최대 글자수를 정적 상수로 관리하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JeongUijeong committed Dec 14, 2023
1 parent f8f01af commit a91a0f7
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class SignUpRequestDto {

private final String emailRegexp = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
private final String passwordRegexp = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$#^()!%*?&])[A-Za-z\\d@$!#^()%*?&]{8,30}$";
private final int nameMin = 2;
private final int nameMax = 30;
private static final String EMAIL_REGEX = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
private static final int NAME_MIN = 2;
private static final int NAME_MAX = 30;
private static final String PASSWORD_REGEX = "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$#^()!%*?&])[A-Za-z\\d@$!#^()%*?&]{8,30}$";

@NotBlank(message = "이메일을 입력하세요.")
@Pattern(regexp = emailRegexp, message = "이메일 형식에 맞게 입력해주세요.")
@Pattern(regexp = EMAIL_REGEX, message = "이메일 형식에 맞게 입력해주세요.")
private String email;
@NotBlank(message = "이름을 입력하세요.")
@Size(min = nameMin, max = nameMax, message = "이름은 최소 2자 이상 최대 30자 이내로 입력하세요.")
@Size(min = NAME_MIN, max = NAME_MAX, message = "이름은 최소 2자 이상 최대 30자 이내로 입력하세요.")
private String name;
@NotBlank(message = "비밀번호를 입력하세요.")
@Pattern(regexp = passwordRegexp)
@Pattern(regexp = PASSWORD_REGEX)
private String password;
@NotBlank(message = "비밀번호 확인을 입력하세요.")
@Pattern(regexp = passwordRegexp)
@Pattern(regexp = PASSWORD_REGEX)
private String passwordConfirm;

@Builder
Expand Down

0 comments on commit a91a0f7

Please sign in to comment.