Browse Source

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

Him188 5 năm trước cách đây
mục cha
commit
ad6d95cee5
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  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