From 7c5346cbabfb9b7057506e0775faa7f74fd31157 Mon Sep 17 00:00:00 2001 From: Jan Tatje Date: Fri, 12 Aug 2022 21:08:59 +0200 Subject: Add support for EAP-PWD (#246) I also added a German translation of the new strings. --- src/components/Settings.js | 13 +++++++++++- src/components/WifiCard.js | 49 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 4 deletions(-) (limited to 'src/components') diff --git a/src/components/Settings.js b/src/components/Settings.js index f12fe35..a0dbab5 100644 --- a/src/components/Settings.js +++ b/src/components/Settings.js @@ -10,9 +10,10 @@ export const Settings = (props) => { const encryptionModes = [ { label: t('wifi.password.encryption.none'), value: '' }, { label: 'WPA/WPA2/WPA3', value: 'WPA' }, + { label: 'WPA2-EAP', value: 'WPA2-EAP' }, { label: 'WEP', value: 'WEP' }, ]; - + const eapMethods = [{ label: 'PWD', value: 'PWD' }]; const langSelectDefaultValue = () => { const t = Translations.filter((t) => t.id === i18n.language); if (t.length !== 1) { @@ -68,6 +69,16 @@ export const Settings = (props) => { options={encryptionModes} onChange={(e) => props.onEncryptionModeChange(e.target.value)} /> + props.onEapMethodChange(e.target.value)} + /> ); }; diff --git a/src/components/WifiCard.js b/src/components/WifiCard.js index 8edf147..35f35a7 100644 --- a/src/components/WifiCard.js +++ b/src/components/WifiCard.js @@ -37,9 +37,11 @@ export const WifiCard = (props) => { const password = !props.settings.encryptionMode ? '' : escape(props.settings.password); - setQrvalue( - `WIFI:T:${props.settings.encryptionMode};S:${ssid};P:${password};H:${props.settings.hiddenSSID};` - ); + const qrval = + props.settings.encryptionMode === 'WPA2-EAP' + ? `WIFI:T:${props.settings.encryptionMode};S:${ssid};P:${password};H:${props.settings.hiddenSSID};E:${props.settings.eapMethod};I:${props.settings.eapIdentity};;` + : `WIFI:T:${props.settings.encryptionMode};S:${ssid};P:${password};H:${props.settings.hiddenSSID};;`; + setQrvalue(qrval); }, [props.settings]); const portraitWidth = () => { @@ -53,6 +55,15 @@ export const WifiCard = (props) => { return hiddenPassword ? '' : t('wifi.password'); }; + const eapIdentityFieldLabel = () => { + const hiddenIdentity = props.settings.encryptionMode !== 'WPA2-EAP'; + return hiddenIdentity ? '' : t('wifi.identity'); + }; + + const eapMethodFieldLabel = () => { + return !eapIdentityFieldLabel() ? '' : t('wifi.encryption.eapMethod'); + }; + return ( { isInvalid={!!props.ssidError} validationMessage={!!props.ssidError && props.ssidError} /> + + props.onEapIdentityChange(e.target.value)} + isInvalid={!!props.eapIdentityError} + validationMessage={ + !!props.eapIdentityError && props.eapIdentityError + } + />