Skip to content

Commit ab2bf77

Browse files
authored
비밀번호 초기화 과정 변경 (#490)
1 parent bc0e9f2 commit ab2bf77

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

api/src/main/kotlin/controller/AuthController.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ class AuthController(
9292
suspend fun verifyResetPasswordCode(
9393
@RequestBody body: VerificationCodeRequest,
9494
): OkResponse {
95-
userService.verifyResetPasswordCode(body.userId!!, body.code)
95+
val user = userService.getUser(body.userId!!)
96+
userService.verifyResetPasswordCode(user, body.code)
9697
return OkResponse()
9798
}
9899

core/src/main/kotlin/users/service/UserService.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ interface UserService {
118118
suspend fun sendResetPasswordCode(email: String)
119119

120120
suspend fun verifyResetPasswordCode(
121-
localId: String,
121+
user: User,
122122
code: String,
123123
)
124124

@@ -567,13 +567,12 @@ class UserServiceImpl(
567567
}
568568

569569
override suspend fun verifyResetPasswordCode(
570-
localId: String,
570+
user: User,
571571
code: String,
572572
) {
573-
val user = userRepository.findByCredentialLocalIdAndActiveTrue(localId) ?: throw UserNotFoundException
574573
val key = RESET_PASSWORD_CODE_PREFIX + user.id
575574
checkVerificationValue(key, code)
576-
redisTemplate.expire(key, Duration.ofMinutes(3)).subscribe()
575+
redisTemplate.expire(key, Duration.ofHours(1)).subscribe()
577576
}
578577

579578
override suspend fun getMaskedEmail(localId: String): String {
@@ -589,7 +588,7 @@ class UserServiceImpl(
589588
code: String,
590589
) {
591590
val user = userRepository.findByCredentialLocalIdAndActiveTrue(localId) ?: throw UserNotFoundException
592-
verifyResetPasswordCode(localId, code)
591+
verifyResetPasswordCode(user, code)
593592
if (!authService.isValidPassword(newPassword)) throw InvalidPasswordException
594593
user.apply {
595594
credential.localPw = authService.buildLocalCredential(user.credential.localId!!, newPassword).localPw

0 commit comments

Comments
 (0)