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

Merge branch 'add-encryption-selection-to-guest-form' into 'dev'

Add encryption selection to WiFiGuestForm

Closes #27

See merge request turris/reforis/foris-js!258
This commit is contained in:
Aleksandr Gumroian 2024-12-09 16:59:57 +01:00
commit ffa1121d39
2 changed files with 56 additions and 3 deletions

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}
</> </>

View File

@ -339,7 +339,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
- First value - First value
+ Second value + Second value
@@ -524,10 +524,87 @@ @@ -524,10 +524,124 @@
<small> <small>
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. 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> </small>
@ -421,13 +421,50 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
+ WPA2/3 pre-shared key, that is required to connect to the network. + WPA2/3 pre-shared key, that is required to connect to the network.
+ </small> + </small>
+ </div> + </div>
+ </div>
+ <div
+ class="mb-3"
+ >
+ <label
+ class="form-label"
+ for="14"
+ >
+ Encryption
+ </label>
+ <select
+ class="form-select"
+ id="14"
+ >
+ <option
+ value="WPA3"
+ >
+ WPA3 only
+ </option>
+ <option
+ value="WPA2/3"
+ >
+ WPA3 with WPA2 as fallback (default)
+ </option>
+ <option
+ value="WPA2"
+ >
+ WPA2 only
+ </option>
+ </select>
+ <div
+ class="form-text"
+ >
+ <small>
+ 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.
+ </small>
+ </div>
+ </div> + </div>
<hr /> <hr />
<div <div
class="form-check form-switch mb-3 d-flex align-items-center" class="form-check form-switch mb-3 d-flex align-items-center"
> >
<input <input
@@ -550,10 +627,11 @@ @@ -550,10 +664,11 @@
<div <div
class="text-end" class="text-end"
> >