1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00

Merge branch 'feature/add-mfp-switch' into 'dev'

Add a switch to disable Management Frame Protection (802.11w)

Closes #26

See merge request turris/reforis/foris-js!202
This commit is contained in:
Aleksandr Gumroian 2022-12-02 15:46:00 +01:00
commit 2a73502710
3 changed files with 65 additions and 18 deletions

View File

@ -8,7 +8,6 @@
import React from "react";
import PropTypes from "prop-types";
import { Switch } from "../../bootstrap/Switch";
import { CheckBox } from "../../bootstrap/CheckBox";
import { PasswordInput } from "../../bootstrap/PasswordInput";
import { RadioSet } from "../../bootstrap/RadioSet";
import { Select } from "../../bootstrap/Select";
@ -65,6 +64,7 @@ DeviceForm.propTypes = {
guest_wifi: PropTypes.object.isRequired,
encryption: PropTypes.string.isRequired,
available_bands: PropTypes.array.isRequired,
ieee80211w_disabled: PropTypes.bool.isRequired,
}),
formErrors: PropTypes.object.isRequired,
setFormValue: PropTypes.func.isRequired,
@ -102,7 +102,7 @@ function DeviceForm({
switchHeading
{...props}
/>
{formData.enabled ? (
{formData.enabled && (
<>
<TextInput
label="SSID"
@ -142,7 +142,7 @@ function DeviceForm({
{...props}
/>
<CheckBox
<Switch
label={_("Hide SSID")}
helpText={HELP_TEXTS.hidden}
checked={formData.hidden}
@ -220,6 +220,25 @@ function DeviceForm({
{...props}
/>
{(formData.encryption === "WPA3" ||
formData.encryption === "WPA2/3") && (
<Switch
label={_("Disable Management Frame Protection")}
helpText={_(
"In case you have trouble connecting to WiFi Access Point, try disabling Management Frame Protection."
)}
checked={formData.ieee80211w_disabled}
onChange={setFormValue((value) => ({
devices: {
[deviceIndex]: {
ieee80211w_disabled: { $set: value },
},
},
}))}
{...props}
/>
)}
{hasGuestNetwork && (
<WifiGuestForm
formData={{
@ -232,8 +251,8 @@ function DeviceForm({
/>
)}
</>
) : null}
{divider ? <hr /> : null}
)}
{divider && <hr />}
</>
);
}

View File

@ -59,6 +59,10 @@ function prepDataToSubmit(formData) {
if (!device.guest_wifi.enabled)
formData.devices[idx].guest_wifi = { enabled: false };
if (device.encryption === "WPA2") {
delete formData.devices[idx].ieee80211w_disabled;
}
});
return formData;
}

View File

@ -337,7 +337,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
- First value
+ Second value
@@ -500,10 +500,92 @@
@@ -524,10 +524,92 @@
>
Enables Wi-Fi for guests, which is separated from LAN network. Devices connected to this network are allowed to access the internet, but aren't allowed to access other devices and the configuration interface of the router. Parameters of the guest network can be set in the Guest network tab.
</small>
@ -347,7 +347,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
+ class=\\"form-group\\"
+ >
+ <label
+ for=\\"22\\"
+ for=\\"24\\"
+ >
+ SSID
+ </label>
@ -356,7 +356,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
+ >
+ <input
+ class=\\"form-control\\"
+ id=\\"22\\"
+ id=\\"24\\"
+ type=\\"text\\"
+ value=\\"TestGuestSSID\\"
+ />
@ -386,7 +386,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
+ class=\\"form-group\\"
+ >
+ <label
+ for=\\"23\\"
+ for=\\"25\\"
+ >
+ Password
+ </label>
@ -396,7 +396,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
+ <input
+ autocomplete=\\"current-password\\"
+ class=\\"form-control is-invalid\\"
+ id=\\"23\\"
+ id=\\"25\\"
+ required=\\"\\"
+ type=\\"password\\"
+ value=\\"\\"
@ -430,7 +430,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
class=\\"form-group switch\\"
>
<div
@@ -527,10 +609,11 @@
@@ -551,10 +633,11 @@
<div
class=\\"text-right\\"
>
@ -449,7 +449,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
- First value
+ Second value
@@ -22,10 +22,488 @@
@@ -22,10 +22,512 @@
Wi-Fi 1
</h2>
</label>
@ -537,7 +537,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ class=\\"form-group\\"
+ >
+ <div
+ class=\\"custom-control custom-checkbox \\"
+ class=\\"custom-control custom-switch\\"
+ >
+ <input
+ class=\\"custom-control-input\\"
@ -549,12 +549,12 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ for=\\"6\\"
+ >
+ Hide SSID
+ <small
+ class=\\"form-text text-muted\\"
+ >
+ If set, network is not visible when scanning for available networks.
+ </small>
+ </label>
+ <small
+ class=\\"form-text text-muted mt-0 mb-3\\"
+ >
+ If set, network is not visible when scanning for available networks.
+ </small>
+ </div>
+ </div>
+ <div
@ -924,6 +924,30 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ class=\\"custom-control-label\\"
+ for=\\"11\\"
+ >
+ Disable Management Frame Protection
+ </label>
+ <small
+ class=\\"form-text text-muted mt-0 mb-3\\"
+ >
+ In case you have trouble connecting to WiFi Access Point, try disabling Management Frame Protection.
+ </small>
+ </div>
+ </div>
+ <div
+ class=\\"form-group\\"
+ >
+ <div
+ class=\\"custom-control custom-switch\\"
+ >
+ <input
+ class=\\"custom-control-input\\"
+ id=\\"12\\"
+ type=\\"checkbox\\"
+ />
+ <label
+ class=\\"custom-control-label\\"
+ for=\\"12\\"
+ >
+ Enable Guest Wi-Fi
+ </label>
+ <small