1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-25 00:11:36 +01:00

Add encryption selection to WiFiGuestForm

This commit is contained in:
Aleksandr Gumroian 2024-12-09 16:50:29 +01:00
parent a63b5bfa4e
commit 6352060da3
No known key found for this signature in database
GPG Key ID: 9E77849C64F0A733

View File

@ -9,9 +9,10 @@ import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { HELP_TEXTS } from "./constants"; import { HELP_TEXTS, ENCRYPTIONMODES } from "./constants";
import WiFiQRCode from "./WiFiQRCode"; import WiFiQRCode from "./WiFiQRCode";
import PasswordInput from "../../bootstrap/PasswordInput"; import PasswordInput from "../../bootstrap/PasswordInput";
import Select from "../../bootstrap/Select";
import Switch from "../../bootstrap/Switch"; import Switch from "../../bootstrap/Switch";
import TextInput from "../../bootstrap/TextInput"; import TextInput from "../../bootstrap/TextInput";
@ -21,6 +22,7 @@ WifiGuestForm.propTypes = {
SSID: PropTypes.string.isRequired, SSID: PropTypes.string.isRequired,
password: PropTypes.string.isRequired, password: PropTypes.string.isRequired,
enabled: PropTypes.bool.isRequired, enabled: PropTypes.bool.isRequired,
encryption: PropTypes.string.isRequired,
}), }),
formErrors: PropTypes.shape({ formErrors: PropTypes.shape({
SSID: PropTypes.string, SSID: PropTypes.string,
@ -89,6 +91,20 @@ export default function WifiGuestForm({
}))} }))}
{...props} {...props}
/> />
<Select
label={_("Encryption")}
choices={ENCRYPTIONMODES}
helpText={HELP_TEXTS.wpa3}
value={formData.encryption}
onChange={setFormValue((value) => ({
devices: {
[formData.id]: {
guest_wifi: { encryption: { $set: value } },
},
},
}))}
{...props}
/>
</> </>
) : null} ) : null}
</> </>