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

minor fix: change error code and return code #70

Merged
merged 1 commit into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion internal/delivery/http/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ func (u UserHandler) UpdateMyPassword(w http.ResponseWriter, r *http.Request) {
err = u.usecase.UpdatePasswordByAccountId(r.Context(), user.AccountId, input.OriginPassword, input.NewPassword, requestUserInfo.GetOrganizationId())
if err != nil {
if strings.Contains(err.Error(), "invalid origin password") {
ErrorJSON(w, r, httpErrors.NewUnauthorizedError(err, "A_INVALID_ORIGIN_PASSWORD", ""))
ErrorJSON(w, r, httpErrors.NewBadRequestError(err, "A_INVALID_ORIGIN_PASSWORD", ""))
return
}

Expand Down
4 changes: 2 additions & 2 deletions internal/usecase/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (u *AuthUsecase) FindId(code string, email string, userName string, organiz
return "", httpErrors.NewBadRequestError(fmt.Errorf("expired code"), "A_EXPIRED_CODE", "")
}
if emailCode.Code != code {
return "", httpErrors.NewBadRequestError(fmt.Errorf("invalid code"), "A_MISMATCH_CODE", "")
return "", httpErrors.NewBadRequestError(fmt.Errorf("invalid code"), "A_INVALID_CODE", "")
}
if err := u.authRepository.DeleteEmailCode(userUuid); err != nil {
return "", httpErrors.NewInternalServerError(err, "", "")
Expand Down Expand Up @@ -197,7 +197,7 @@ func (u *AuthUsecase) FindPassword(code string, accountId string, email string,
return httpErrors.NewBadRequestError(fmt.Errorf("expired code"), "A_EXPIRED_CODE", "")
}
if emailCode.Code != code {
return httpErrors.NewBadRequestError(fmt.Errorf("invalid code"), "A_MISMATCH_CODE", "")
return httpErrors.NewBadRequestError(fmt.Errorf("invalid code"), "A_INVALID_CODE", "")
}
randomPassword := helper.GenerateRandomString(passwordLength)

Expand Down
3 changes: 1 addition & 2 deletions pkg/httpErrors/errorCode.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ var errorMap = map[ErrorCode]string{
"A_INVALID_TOKEN": "사용자 토큰 오류",
"A_INVALID_USER_CREDENTIAL": "비밀번호가 일치하지 않습니다.",
"A_INVALID_ORIGIN_PASSWORD": "기존 비밀번호가 일치하지 않습니다.",
"A_MISMATCH_PASSWORD": "비밀번호가 일치하지 않습니다.",
"A_MISMATCH_CODE": "인증번호가 일치하지 않습니다.",
"A_INVALID_CODE": "인증번호가 일치하지 않습니다.",
"A_NO_SESSION": "세션 정보를 찾을 수 없습니다.",
"A_EXPIRED_CODE": "인증번호가 만료되었습니다.",

Expand Down