1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-06-25 19:43:59 +00:00

Add WPA3 option

This commit is contained in:
Marek Sašek 2021-10-01 17:27:48 +02:00
parent 2644f6fd70
commit 0beb1f0418
No known key found for this signature in database
GPG Key ID: 8791897AFCF3602F
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;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information.
@ -18,6 +18,11 @@ export const HWMODES = {
"11g": "2.4",
"11a": "5",
};
export const ENCRYPTIONMODES = {
WPA3: _("WPA3 only"),
"WPA2/3": _("WPA3 with WPA2 as fallback (default)"),
WPA2: _("WPA2 only"),
};
export const HELP_TEXTS = {
ssid: _(
`SSID which contains non-standard characters could cause problems on some devices.`
@ -42,4 +47,7 @@ export const HELP_TEXTS = {
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.
`),
wpa3: _(
"The WPA3 standard is the new most secure encryption method that is suggested to be used with any device that supports it. The older devices without WPA3 support require older WPA2. If you experience issues with connecting older devices, try to enable WPA2."
),
};