Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue#78 이메일 전송 및 인증번호 검증 #79

Merged
merged 25 commits into from
Jan 10, 2025

Conversation

Dobbymin
Copy link
Collaborator

@Dobbymin Dobbymin commented Jan 7, 2025

📝 상세 내용

  • 인증번호 이메일 전송
  • 인증번호 확인
  • 이메일 관련 Input 맨 아래로 위치 변경
  • Input 오류 해결
  • 회원가입시 인증번호 제출 제외하기

#️⃣ 이슈 번호

🔗 참고 자료

📷 스크린샷(선택)

@Dobbymin Dobbymin added 🎉 feat 🎨 desgin HTML, CSS 등 UI 구현 labels Jan 7, 2025
@Dobbymin Dobbymin linked an issue Jan 7, 2025 that may be closed by this pull request
3 tasks
@Dobbymin Dobbymin requested review from ppochaco and joojjang January 7, 2025 17:34
@Dobbymin Dobbymin changed the base branch from main to develop January 7, 2025 18:05
@ppochaco
Copy link
Member

ppochaco commented Jan 7, 2025

아직 코드를 보진 않았는데 해당 에러는 input 렌더링 관련 에러입니다. 구글링하면 여러 케이스 나오니까 원인을 찾고 한번 해결해보세용

Copy link
Member

@ppochaco ppochaco left a comment

Choose a reason for hiding this comment

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

인증번호 에러처리가 정상적으로 동작하지 않아요ㅜㅜ 다른 코멘트는 마이너한 부분이니, 해당 이슈 먼저 해결하고 언급해주세용

  • 인증번호 확인에서 에러 반환 받았을 때, 에러 메세지가 유저한테 안보여요
스크린샷 2025-01-10 오후 2 12 44

src/schema/auth.ts Outdated Show resolved Hide resolved
setMessage(message)
}

const onError = (error: Error) => {
Copy link
Member

@ppochaco ppochaco Jan 10, 2025

Choose a reason for hiding this comment

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

(🚨 이거 먼저 해결해주세요)

서버에서 반한되는 에러 타입과 프론트에서 처리하는 에러 타입이 다르게 생긴 거 같아요. swagger와 Network에서 실제로 반환되는 에러 타입을 확인하고, 아래의 에러 파싱을 수정해주세용

추가로 field가 email, code, userid일 때, 인증번호 field에서 에러 메세지를 보여주고 싶은 건가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

스웨거에 정의된 에러 타입이 많이 없어서 직접 하나씩 필드 비워보고 확인해서 추가해보았는데, 어떤식으로 에러타입이 다른지 알수있나요??

인증번호 field에 필요한 값이 userId, email, code 라서 인증번호 field에서 에러메세지를 보여주고 싶었던게 맞습니다!

Copy link
Member

@ppochaco ppochaco Jan 10, 2025

Choose a reason for hiding this comment

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

  1. 인증번호 확인 버튼을 눌렀을 때, 인증번호 Input 밑에 다른 input의 유효성 에러 메시지가 보이니까 사용자는 해당 다른 Input의 값을 입력해야겠다는 생각을 못할 수도 있을 거 같아요..!
    input 밑에 인증번호 입력 전에 userId, email을 입력하라는 문구를 추가하고, userId와 email이 입력되어있을 때만 인증번호 확인 버튼을 누를 수 있게 하는 게 어떤가용?
스크린샷 2025-01-10 오후 4 25 49

Copy link
Member

Choose a reason for hiding this comment

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

아.. 400에러가 다음과 같이 2가지의 형식으로 반환되어서 아래의 형식이 파싱되지 않아서 안보였던 거 같아요! 이건 백엔드 측에 수정을 요청 해야할 것 같네용 프론트는 코드 수정 없어도 될 거 같아욤

{
    "code": "COMMON_001",
    "message": "Parameter is invalid.",
    "errors": [
        {
            "field": "code",
            "message": "인증 코드 형식이 맞지 않습니다."
        }
    ]
}
{"code":"EMAIL_001","message":"인증 코드가 만료되었거나 일치하지 않습니다."}

Copy link
Member

@ppochaco ppochaco Jan 10, 2025

Choose a reason for hiding this comment

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

스웨거에 정의된 에러 타입이 많이 없어서 직접 하나씩 필드 비워보고 확인해서 추가해보았는데, 어떤식으로 에러타입이 다른지 알수있나요??

에러 타입은 백엔드와 약속이어서 따로 확인할 방법은 소통,, 밖에 없는 거 같아요. 저는 의도적으로 이상한 값을 넣어서 테스트를 많이 해보는 편입니당 저희 프로젝트에서는 일반적으로 {"code": "code1","message":"에러 메세지."} 타입을 사용하고, 회원가입처럼 여러 필드에서 input 유효성 검사를 할 땐 아래의 형식처럼 에러를 반환합니다,

{
    "code": "code",
    "message": "message.",
    "errors": [
        {
            "field": "field명",
            "message": "에러 메세지."
        }
    ]
}

Copy link
Member

@ppochaco ppochaco Jan 10, 2025

Choose a reason for hiding this comment

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

@Dobbymin
프론트에서 Input 유효성 검사 할 때는 1번에 사용되는 에러를 참고해서 추가하면 될 거 같고,
api에 따라 달라지는 에러는 swagger를 참고해서 에러 메세지를 보여주거나 액션을 추가하면 될 거 같아요.

결론적으로 백엔드 추가 수정은 없고, 400 에러 중 code EMAIL_001 인 에러일 때, 파싱해서 처리하는 거 추가하면 될 거 같습니당

  1. input 자체에 대한 유효성 검사 후 반환되는 에러(/src/models/data-contracts.ts 에서 확인 가능)
{
    "code": "COMMON_001",
    "message": "Parameter is invalid.",
    "errors": [
        {
            "field": "code",
            "message": "인증 코드 형식이 맞지 않습니다."
        }
    ]
}
  1. 로직 검사 후 반환되는 에러(swagge에서 확인 가능)
{"code":"EMAIL_001","message":"인증 코드가 만료되었거나 일치하지 않습니다."}

src/app/auth/signup/_components/form/Form.tsx Outdated Show resolved Hide resolved
src/app/auth/signup/_components/form/Form.tsx Show resolved Hide resolved
src/app/auth/signup/_components/form/Form.tsx Show resolved Hide resolved
@ppochaco
Copy link
Member

고생 많으셨습니다 해당 이슈도 머지하겠습니당

@ppochaco ppochaco merged commit 35aa82e into develop Jan 10, 2025
1 check passed
@ppochaco ppochaco deleted the feature#78-email-validation branch January 10, 2025 14:50
@ppochaco ppochaco removed their assignment Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 desgin HTML, CSS 등 UI 구현 🎉 feat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

회원가입 시 이메일 인증 및 인증번호 입력
2 participants