Update status code for ApiError.InvalidCredentialError
This commit is contained in:
parent
5d93b8054e
commit
3d1722fc62
@ -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)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user