diff --git a/src/common/WiFiSettings/WiFiForm.js b/src/common/WiFiSettings/WiFiForm.js
index 6005d6b..63bfd47 100644
--- a/src/common/WiFiSettings/WiFiForm.js
+++ b/src/common/WiFiSettings/WiFiForm.js
@@ -105,6 +105,7 @@ function DeviceForm({
label="SSID"
value={formData.SSID}
error={formErrors.SSID || null}
+ helpText={HELP_TEXTS.ssid}
required
onChange={setFormValue((value) => ({
devices: {
diff --git a/src/common/WiFiSettings/WiFiGuestForm.js b/src/common/WiFiSettings/WiFiGuestForm.js
index 93380cd..7ae88c0 100644
--- a/src/common/WiFiSettings/WiFiGuestForm.js
+++ b/src/common/WiFiSettings/WiFiGuestForm.js
@@ -57,6 +57,7 @@ export default function WifiGuestForm({
label="SSID"
value={formData.SSID}
error={formErrors.SSID}
+ helpText={HELP_TEXTS.ssid}
onChange={setFormValue((value) => ({
devices: {
[formData.id]: {
diff --git a/src/common/WiFiSettings/WiFiSettings.js b/src/common/WiFiSettings/WiFiSettings.js
index a16d8d7..be455af 100644
--- a/src/common/WiFiSettings/WiFiSettings.js
+++ b/src/common/WiFiSettings/WiFiSettings.js
@@ -63,6 +63,12 @@ function prepDataToSubmit(formData) {
return formData;
}
+export function byteCount(string) {
+ const buffer = Buffer.from(string, "utf-8");
+ const count = buffer.byteLength;
+ return count;
+}
+
export function validator(formData) {
const formErrors = formData.devices.map((device) => {
if (!device.enabled) return {};
@@ -71,6 +77,8 @@ export function validator(formData) {
if (device.SSID.length > 32)
errors.SSID = _("SSID can't be longer than 32 symbols");
if (device.SSID.length === 0) errors.SSID = _("SSID can't be empty");
+ if (byteCount(device.SSID) > 32)
+ errors.SSID = _("SSID can't be longer than 32 bytes");
if (device.password.length < 8)
errors.password = _("Password must contain at least 8 symbols");
@@ -82,6 +90,8 @@ export function validator(formData) {
guest_wifi_errors.SSID = _("SSID can't be longer than 32 symbols");
if (device.guest_wifi.SSID.length === 0)
guest_wifi_errors.SSID = _("SSID can't be empty");
+ if (byteCount(device.guest_wifi.SSID) > 32)
+ guest_wifi_errors.SSID = _("SSID can't be longer than 32 bytes");
if (device.guest_wifi.password.length < 8)
guest_wifi_errors.password = _(
diff --git a/src/common/WiFiSettings/__tests__/WiFiSettings.test.js b/src/common/WiFiSettings/__tests__/WiFiSettings.test.js
index 4923c67..7f533c2 100644
--- a/src/common/WiFiSettings/__tests__/WiFiSettings.test.js
+++ b/src/common/WiFiSettings/__tests__/WiFiSettings.test.js
@@ -19,7 +19,7 @@ import {
twoDevices,
threeDevices,
} from "./__fixtures__/wifiSettings";
-import { WiFiSettings, validator } from "../WiFiSettings";
+import { WiFiSettings, validator, byteCount } from "../WiFiSettings";
describe("