File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
api/src/main/kotlin/controller
core/src/main/kotlin/users/service Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments