From ae5a816156ed554cb94a251088ce1b5005d5112e Mon Sep 17 00:00:00 2001 From: Li Zhineng Date: Tue, 15 Jul 2025 20:53:42 +0800 Subject: add doc --- main.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.mjs b/main.mjs index 00e6d8a..d624101 100644 --- a/main.mjs +++ b/main.mjs @@ -509,11 +509,18 @@ class WifiCredentialsForm extends ProgressibleForm { } } + /** + * Validate with the IEEE 802.11 standard. + * + * @param {string} ssid - The Wi-Fi name + * @param {string} password - The Password (WPA/WPA2-PSK) + */ validate(ssid, password) { if (ssid === '' ) { throw new Error('SSID cannot be empty.') } + // The SSID is up to 32 characters if (ssid.length > 32) { throw new Error('SSID cannot be longer than 32 characters.') } @@ -522,6 +529,7 @@ class WifiCredentialsForm extends ProgressibleForm { throw new Error('Password cannot be empty.') } + // The password is between 8 and 63 characters if (password.length < 8 || password.length > 63) { throw new Error('Password must be between 8 and 63 characters long.') } -- cgit v1.2.3