Bladeren bron

Require password length to be at most 16 on BotAccount init. #993

Him188 5 jaren geleden
bovenliggende
commit
ad6d95cee5
1 gewijzigde bestanden met toevoegingen van 3 en 1 verwijderingen
  1. 3 1
      mirai-core/src/commonMain/kotlin/BotAccount.kt

+ 3 - 1
mirai-core/src/commonMain/kotlin/BotAccount.kt

@@ -33,7 +33,9 @@ internal data class BotAccount(
         id,
         passwordPlainText.md5(),
         phoneNumber
-    )
+    ) {
+        require(passwordPlainText.length <= 16) { "Password length must be at most 16." }
+    }
 
     override fun equals(other: Any?): Boolean {
         if (this === other) return true