Update status code for ApiError.InvalidCredentialError
This commit is contained in:
@@ -36,11 +36,11 @@ class UserController(kodein: Kodein) : KodeinController(kodein) {
|
|||||||
.where { Users.username eq credential.username }
|
.where { Users.username eq credential.username }
|
||||||
.map { row -> row[Users.email]!! to row[Users.password]!! }
|
.map { row -> row[Users.email]!! to row[Users.password]!! }
|
||||||
.firstOrNull()
|
.firstOrNull()
|
||||||
?: return@post call.respond(HttpStatusCode.BadRequest, ApiError.InvalidCredentialError)
|
?: return@post call.respond(HttpStatusCode.Unauthorized, ApiError.InvalidCredentialError)
|
||||||
|
|
||||||
|
|
||||||
if (!BCrypt.checkpw(credential.password, password)) {
|
if (!BCrypt.checkpw(credential.password, password)) {
|
||||||
return@post call.respond(HttpStatusCode.BadRequest, ApiError.InvalidCredentialError)
|
return@post call.respond(HttpStatusCode.Unauthorized, ApiError.InvalidCredentialError)
|
||||||
}
|
}
|
||||||
|
|
||||||
return@post call.respond(Response(simpleJwt.sign(email)))
|
return@post call.respond(Response(simpleJwt.sign(email)))
|
||||||
|
|||||||
Reference in New Issue
Block a user