Skip to content

Basic 김현제 sprint3#40

Open
ranflir wants to merge 24 commits intocodeit-sprint-fullstack:basicfrom
ranflir:basic-김현제-sprint3

Hidden character warning

The head ref may contain hidden characters: "basic-\uae40\ud604\uc81c-sprint3"
Open

Basic 김현제 sprint3#40
ranflir wants to merge 24 commits intocodeit-sprint-fullstack:basicfrom
ranflir:basic-김현제-sprint3

Conversation

@ranflir
Copy link
Copy Markdown
Collaborator

@ranflir ranflir commented Dec 27, 2025

요구사항

기본

  • [o] 로그인, 회원가입 페이지 공통
    로그인 및 회원가입 페이지의 이메일, 비밀번호, 비밀번호 확인 input에 필요한 유효성 검증 함수를 만들고 적용해 주세요.
    이메일 input에서 focus out 할 때, 값이 없을 경우 input에 빨강색 테두리와 아래에 “이메일을 입력해주세요.” 빨강색 에러 메세지를 보입니다.
    이메일 input에서 focus out 할 때, 이메일 형식에 맞지 않는 경우 input에 빨강색 테두리와 아래에 “잘못된 이메일 형식입니다” 빨강색 에러 메세지를 보입니다.
    비밀번호 input에서 focus out 할 때, 값이 없을 경우 아래에 “비밀번호를 입력해주세요.” 에러 메세지를 보입니다
    비밀번호 input에서 focus out 할 때, 값이 8자 미만일 경우 아래에 “비밀번호를 8자 이상 입력해주세요.” 에러 메세지를 보입니다.
    input 에 빈 값이 있거나 에러 메세지가 있으면 ‘로그인’ 버튼은 비활성화 됩니다.
    Input 에 유효한 값을 입력하면 ‘로그인' 버튼이 활성화 됩니다.
    활성화된 ‘로그인’ 버튼을 누르면 “/items” 로 이동합니다
  • [o] 회원가입을 위해 이메일, 닉네임, 비밀번호, 비밀번호 확인을 입력한 뒤, 회원가입 버튼을 클릭하세요. 그 후에는 다음 조건에 따라 회원가입 가능 여부를 alert로 알려주세요.
    입력한 이메일이 이미 데이터베이스(USER_DATA)에 존재하는 경우, '사용 중인 이메일입니다'라는 메시지를 alert로 표시합니다.
    입력한 이메일이 데이터베이스(USER_DATA)에 없는 경우, 회원가입이 성공적으로 처리되었으므로 로그인 페이지(”/login”)로 이동합니다.

심화

  • [x]

주요 변경사항

  • 입력 유효성 검사(Validation): 정규표현식을 이용한 이메일 형식 체크 및 8자 이상의 비밀번호 길이 검증을 구현했습니다.

  • 실시간 에러 피드백: focusout 이벤트를 사용하여 사용자가 입력을 마치자마자 즉시 빨간색 테두리와 에러 메시지를 보여주는 UI 로직을 완성했습니다.

  • 데이터 인증(Authentication): USER_DATA 상수를 활용하여 실제 등록된 사용자인지 확인하는 로그인 로직을 구현했습니다.

  • 회원가입 심화 로직: * 비밀번호와 비밀번호 확인 칸이 일치하는지 대조하는 로직을 추가했습니다.

  • 이메일 중복 체크: 가입하려는 이메일이 이미 존재하는지 some() 메서드로 확인하여 실시간으로 경고를 띄웠습니다.

  • 버튼 상태 제어: 모든 조건(형식, 중복, 일치)이 만족될 때만 버튼이 활성화되도록 disabled 속성을 동적으로 제어했습니다.

스크린샷

멘토에게

  • 너무 어려운데 이게 맞는건지 모르겠습니다.

@ranflir ranflir self-assigned this Dec 27, 2025
@ranflir ranflir added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Dec 27, 2025
@ranflir ranflir requested a review from wseungjin December 27, 2025 14:11
@ranflir ranflir added the 최종제출 스프린트 미션 최종 제출 PR입니다. 코드리뷰 및 평가해주세요! label Dec 27, 2025
Copy link
Copy Markdown
Collaborator

@wseungjin wseungjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이번주도 수고 많으셨습니다~

}
gtag('js', new Date());

gtag('config', 'GTM-NXNMB8PH');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

컨피그는 따로 관리해주세요~

return emailRegex.test(email);
}

function validateEmail() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkEmail 이런식으로 하고 validateEmail 함수를 따로 가져가도 좋을꺼 같네요
뭐 솔직히 크게 문제되지는 않는 수준인데 함수를 더 쪼개는 연습을 해보시면 좋을거 같아요.

passwordInput.value === passwordConfirmInput.value &&
passwordConfirmInput.value !== '';

// 추가: 이메일이 중복되지 않았는지 확인하는 조건
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주석이 항상 필요하진 않습니다. 변수명에 좀 신경쓰는 방향으로 중복되지 않게 고민해보세요.
주석도 유지보수의 대상이 될 수 있다는 점을 참고하면서 코드를 짜주세요.

const isLoginPage = !document.querySelector('#passwordConfirmation');

// 기본적으로는 이메일과 비밀번호만 체크 (로그인 페이지 기준)
let isAllValid = isEmailValid && isPasswordValid;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let이 편하긴 할 수 있는데 최대한 let을 안쓰는 방향으로 연습해 봐도 좋을거같아요.

const emailInput = document.querySelector('#email');

function isValidEmail(email) {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


if (passwordConfirmInput) {
passwordConfirmInput.addEventListener('focusout', validatePasswordConfirm);
passwordConfirmInput.addEventListener('input', checkButtonState);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

파일이 충분히 큰거 같아요 좀 쪼개는 고민을 해봤어도 좋을꺼 같습니다~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. 최종제출 스프린트 미션 최종 제출 PR입니다. 코드리뷰 및 평가해주세요!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants