Skip to content

Commit abd533f

Browse files
authored
Imporve code (#25)
* check for null * remove redundant Users
1 parent 7112c4b commit abd533f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/kotlin/com/personia/dao/user/UserDaoImpl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class UserDaoImpl : UserDaoFacade {
1717

1818
override suspend fun createUser(user: User): User? = dbQuery {
1919
val insertStatement = Users.insert {
20-
it[Users.username] = user.username
21-
it[Users.password] = user.password
20+
it[username] = user.username
21+
it[password] = user.password
2222
}
2323
insertStatement.resultedValues?.singleOrNull()?.let(::resultRowToNode)
2424
}

src/main/kotlin/com/personia/plugins/Authentication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fun Application.configureAuthentication(config: ApplicationConfig) {
2626
.build()
2727
)
2828
validate { credential ->
29-
if (credential.payload.getClaim("username").asString() != "") {
29+
if (!credential.payload.getClaim("username").asString().isNullOrEmpty()) {
3030
JWTPrincipal(credential.payload)
3131
} else {
3232
null

0 commit comments

Comments
 (0)