회원탈퇴 API - 회원탈퇴시 토큰 삭제
This commit is contained in:
parent
d9f6ac01f4
commit
234e02dca4
|
@ -389,12 +389,8 @@ class MemberService(
|
||||||
lock.write { tokenRepository.deleteById(memberId) }
|
lock.write { tokenRepository.deleteById(memberId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getOrCreateLock(memberId: Long): ReentrantReadWriteLock {
|
|
||||||
return tokenLocks.computeIfAbsent(memberId) { ReentrantReadWriteLock() }
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun signOut(signOutRequest: SignOutRequest, user: User) {
|
fun signOut(signOutRequest: SignOutRequest, token: String, user: User) {
|
||||||
val member = repository.findByEmail(user.username) ?: throw SodaException("로그인 정보를 확인해주세요.")
|
val member = repository.findByEmail(user.username) ?: throw SodaException("로그인 정보를 확인해주세요.")
|
||||||
if (!passwordEncoder.matches(signOutRequest.password, member.password)) {
|
if (!passwordEncoder.matches(signOutRequest.password, member.password)) {
|
||||||
throw SodaException("비밀번호가 일치하지 않습니다.")
|
throw SodaException("비밀번호가 일치하지 않습니다.")
|
||||||
|
@ -404,10 +400,15 @@ class MemberService(
|
||||||
throw SodaException("탈퇴하려는 이유를 입력해 주세요.")
|
throw SodaException("탈퇴하려는 이유를 입력해 주세요.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logoutAll(memberId = member.id!!)
|
||||||
member.isActive = false
|
member.isActive = false
|
||||||
|
|
||||||
val signOut = SignOut(reason = signOutRequest.reason)
|
val signOut = SignOut(reason = signOutRequest.reason)
|
||||||
signOut.member = member
|
signOut.member = member
|
||||||
signOutRepository.save(signOut)
|
signOutRepository.save(signOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getOrCreateLock(memberId: Long): ReentrantReadWriteLock {
|
||||||
|
return tokenLocks.computeIfAbsent(memberId) { ReentrantReadWriteLock() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue