Skip to content

Commit

Permalink
♻️ ktlint format
Browse files Browse the repository at this point in the history
  • Loading branch information
enbraining committed Jun 28, 2024
1 parent f1a554b commit 90c3169
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import team.underlive.underlive.global.exception.error.HttpException
@Service
class AuthService(
private val userRepository: UserRepository,
private val passwordEncoder: PasswordEncoder
private val passwordEncoder: PasswordEncoder,
) {
fun createUser(userJoinRequest: UserJoinRequest) {
if (userRepository.existsByEmail(userJoinRequest.email)) {
Expand All @@ -36,14 +36,14 @@ class AuthService(
}

fun loginUser(userLoginRequest: UserLoginRequest): UserLoginResponse {
val user = userRepository.findByEmail(userLoginRequest.email)
.orElseThrow { HttpException(HttpStatus.NOT_FOUND, "해당 이메일을 사용하는 유저를 찾을 수 없습니다.") }

if(!passwordEncoder.matches(userLoginRequest.password, user.password)){
throw HttpException(HttpStatus.BAD_REQUEST, "비밀번호가 일치하지 않습니다.")
}

val user =
userRepository.findByEmail(userLoginRequest.email)
.orElseThrow { HttpException(HttpStatus.NOT_FOUND, "해당 이메일을 사용하는 유저를 찾을 수 없습니다.") }

if (!passwordEncoder.matches(userLoginRequest.password, user.password))
{
throw HttpException(HttpStatus.BAD_REQUEST, "비밀번호가 일치하지 않습니다.")
}

return UserLoginResponse("test", "test")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ import java.util.UUID

interface UserRepository : JpaRepository<User, UUID> {
fun existsByEmail(email: String): Boolean

fun findByEmail(email: String): Optional<User>
}

0 comments on commit 90c3169

Please sign in to comment.