1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-10-16 18:33:37 +02:00

Add WPA3 option

This commit is contained in:
Marek Sašek
2021-10-01 17:27:48 +02:00
parent 2644f6fd70
commit 0beb1f0418
2 changed files with 32 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ import { Select } from "../../bootstrap/Select";
import { TextInput } from "../../bootstrap/TextInput";
import WiFiQRCode from "./WiFiQRCode";
import WifiGuestForm from "./WiFiGuestForm";
import { HELP_TEXTS, HTMODES, HWMODES } from "./constants";
import { HELP_TEXTS, HTMODES, HWMODES, ENCRYPTIONMODES } from "./constants";
WiFiForm.propTypes = {
formData: PropTypes.shape({ devices: PropTypes.arrayOf(PropTypes.object) })
@@ -63,6 +63,7 @@ DeviceForm.propTypes = {
htmode: PropTypes.string.isRequired,
channel: PropTypes.string.isRequired,
guest_wifi: PropTypes.object.isRequired,
encryption: PropTypes.string.isRequired,
}),
formErrors: PropTypes.object.isRequired,
setFormValue: PropTypes.func.isRequired,
@@ -198,6 +199,20 @@ function DeviceForm({
{...props}
/>
<Select
label={_("Encryption")}
choices={getEncryptionChoices(formData)}
helpText={HELP_TEXTS.wpa3}
value={formData.encryption}
onChange={setFormValue((value) => ({
devices: {
[deviceIndex]: { encryption: { $set: value } },
},
}))}
customOrder
{...props}
/>
{hasGuestNetwork && (
<WifiGuestForm
formData={{
@@ -256,3 +271,10 @@ function getHwmodeChoices(device) {
value: availableBand.hwmode,
}));
}
function getEncryptionChoices(device) {
if (device.encryption === "custom") {
ENCRYPTIONMODES.custom = _("Custom");
}
return ENCRYPTIONMODES;
}