Skip to content

Commit

Permalink
feat: 비밀번호가 틀렸을 때의 응답으로 수정 (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddingmin authored Jan 3, 2025
1 parent b6b4a12 commit 99842d1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ enum class ErrorCode(
MEMBER_ALREADY_EXISTS("ME0001", "해당 이메일의 사용자가 이미 존재합니다"),
PASSCORD_ALREADY_SET("ME0002", "이미 비밀번호가 지정되었습니다. 관리자에게 문의하세요"),
PASSCORD_NOT_SET("ME0003", "비밀번호가 설정되지 않았습니다. 먼저 설정하세요"),
MEMBER_NOT_FOUND("ME0004", "사용자를 찾을 수 없습니다"),
PASSCORD_NOT_MATCHED("ME0004", "비밀번호가 일치하지 않습니다"),
MEMBER_NOT_FOUND("ME0005", "사용자를 찾을 수 없습니다"),

/**
* 세션 관련 오류
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ open class MemberException(
class MemberAlreadyExistsException : MemberException(ErrorCode.MEMBER_ALREADY_EXISTS)
class PassCordAlreadySetException : MemberException(ErrorCode.PASSCORD_ALREADY_SET)
class PassCordNotSetException : MemberException(ErrorCode.PASSCORD_NOT_SET)
class PassCordNotMatchedException : MemberException(ErrorCode.PASSCORD_NOT_MATCHED)
class MemberNotFoundException : MemberException(ErrorCode.MEMBER_NOT_FOUND)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.depromeet.makers.domain.usecase

import com.depromeet.makers.domain.exception.MemberNotFoundException
import com.depromeet.makers.domain.exception.PassCordNotMatchedException
import com.depromeet.makers.domain.exception.PassCordNotSetException
import com.depromeet.makers.domain.gateway.MemberGateway
import com.depromeet.makers.domain.gateway.TokenGateway
Expand All @@ -26,7 +27,7 @@ class GenerateTokenWithEmailAndPassCord(
if (!member.hasPassCord()) throw PassCordNotSetException()

val isPassCordMatched = EncryptUtils.isMatch(input.passCord, member.passCord!!)
if (!isPassCordMatched) throw MemberNotFoundException()
if (!isPassCordMatched) throw PassCordNotMatchedException()

return GenerateTokenWithEmailAndPassCordOutput(
accessToken = tokenGateway.generateAccessToken(member),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.depromeet.makers.domain.usecase

import com.depromeet.makers.domain.exception.MemberNotFoundException
import com.depromeet.makers.domain.exception.PassCordNotMatchedException
import com.depromeet.makers.domain.exception.PassCordNotSetException
import com.depromeet.makers.domain.gateway.MemberGateway
import com.depromeet.makers.domain.gateway.TokenGateway
Expand Down Expand Up @@ -88,8 +89,8 @@ class GenerateTokenWithEmailAndPassCordTest: BehaviorSpec({
)
)
}
Then("MemberNotFoundException 던짐") {
shouldThrow<MemberNotFoundException>(executor)
Then("PassCordNotMatchedException 던짐") {
shouldThrow<PassCordNotMatchedException>(executor)
}
}
}
Expand Down

0 comments on commit 99842d1

Please sign in to comment.