Skip to content

Commit

Permalink
구버전에서 비번 찾기 요청하는 경우 오류 응답 (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
asp345 authored Dec 4, 2024
1 parent b42d450 commit c7e6566
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/src/main/kotlin/common/exception/ErrorType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ enum class ErrorType(
INVALID_VERIFICATION_CODE(HttpStatus.BAD_REQUEST, 40018, "인증 코드가 유효하지 않습니다.", "인증 코드가 유효하지 않습니다."),
ALREADY_LOCAL_ACCOUNT(HttpStatus.BAD_REQUEST, 40019, "이미 로컬 계정이 존재합니다.", "이미 로컬 계정이 존재합니다."),
ALREADY_SOCIAL_ACCOUNT(HttpStatus.BAD_REQUEST, 40020, "이미 소셜 계정이 존재합니다.", "이미 소셜 계정이 존재합니다."),
UPDATE_APP_VERSION(HttpStatus.BAD_REQUEST, 40021, "앱 버전을 업데이트해주세요.", "앱 버전을 업데이트해주세요."),

SOCIAL_CONNECT_FAIL(HttpStatus.UNAUTHORIZED, 40100, "소셜 로그인에 실패했습니다.", "소셜 로그인에 실패했습니다."),

Expand Down
2 changes: 2 additions & 0 deletions core/src/main/kotlin/common/exception/Snu4tException.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ object AlreadyLocalAccountException : Snu4tException(ErrorType.ALREADY_LOCAL_ACC

object AlreadySocialAccountException : Snu4tException(ErrorType.ALREADY_SOCIAL_ACCOUNT)

object UpdateAppVersionException : Snu4tException(ErrorType.UPDATE_APP_VERSION)

object SocialConnectFailException : Snu4tException(ErrorType.SOCIAL_CONNECT_FAIL)

object NoUserFcmKeyException : Snu4tException(ErrorType.NO_USER_FCM_KEY)
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/kotlin/users/service/UserService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.wafflestudio.snu4t.common.exception.InvalidVerificationCodeException
import com.wafflestudio.snu4t.common.exception.Snu4tException
import com.wafflestudio.snu4t.common.exception.SocialProviderNotAttachedException
import com.wafflestudio.snu4t.common.exception.TooManyVerificationCodeRequestException
import com.wafflestudio.snu4t.common.exception.UpdateAppVersionException
import com.wafflestudio.snu4t.common.exception.UserNotFoundException
import com.wafflestudio.snu4t.common.exception.WrongLocalIdException
import com.wafflestudio.snu4t.common.exception.WrongPasswordException
Expand Down Expand Up @@ -553,6 +554,7 @@ class UserServiceImpl(
}

override suspend fun sendResetPasswordCode(email: String) {
if (email.replace(emailMaskRegex, "*") == email) throw UpdateAppVersionException
val user = userRepository.findByEmailIgnoreCaseAndIsEmailVerifiedTrueAndActiveTrue(email) ?: throw UserNotFoundException
val key = RESET_PASSWORD_CODE_PREFIX + user.id
val code = Base64.getUrlEncoder().encodeToString(Random.nextBytes(6))
Expand Down

0 comments on commit c7e6566

Please sign in to comment.