aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/DatabaseController.kt
diff options
context:
space:
mode:
authorMarvin Borner2019-04-15 23:24:06 +0200
committerMarvin Borner2019-04-15 23:24:06 +0200
commitce627b7b74b2a7b5ac53322df5945e00a8462b24 (patch)
tree1b0be309e72f3c1bb34c56c27122fc64caac82c7 /src/main/kotlin/DatabaseController.kt
parent6904e09a650d71925d54f12bc8da9ea80ce0565f (diff)
Added directory size evaluation
Diffstat (limited to 'src/main/kotlin/DatabaseController.kt')
-rw-r--r--src/main/kotlin/DatabaseController.kt6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/kotlin/DatabaseController.kt b/src/main/kotlin/DatabaseController.kt
index 305c405..088f342 100644
--- a/src/main/kotlin/DatabaseController.kt
+++ b/src/main/kotlin/DatabaseController.kt
@@ -92,7 +92,7 @@ class DatabaseController(dbFileLocation: String = "main.db") {
val usersId = UserData.insert {
it[username] = usernameString
it[password] = BCrypt.withDefaults().hashToString(12, passwordString.toCharArray())
- it[verification] = generateRandomString(64)
+ it[verification] = generateRandomString()
}[UserData.id]
UserRoles.insert { roles ->
@@ -215,7 +215,7 @@ class DatabaseController(dbFileLocation: String = "main.db") {
FileLocation.insert {
it[path] = fileLocation
it[userId] = usersId
- it[accessId] = generateRandomString(64)
+ it[accessId] = generateRandomString()
}
} catch (err: org.jetbrains.exposed.exceptions.ExposedSQLException) {
log.warning("File already exists!")
@@ -316,7 +316,7 @@ class DatabaseController(dbFileLocation: String = "main.db") {
/**
* Generates a random string with [length] characters
*/
- private fun generateRandomString(length: Int): String {
+ private fun generateRandomString(length: Int = 64): String {
val allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz0123456789"
return (1..length)
.map { allowedChars.random() }