diff options
| author | Jan Tatje <jan@jnt.io> | 2022-08-12 21:08:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-12 12:08:59 -0700 |
| commit | 7c5346cbabfb9b7057506e0775faa7f74fd31157 (patch) | |
| tree | daa1032ee1528e70f1b0322c5f3974a738633b21 /src/components | |
| parent | eba3c1a6629e832db1da713825043d162bec9d28 (diff) | |
Add support for EAP-PWD (#246)
I also added a German translation of the new strings.
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Settings.js | 13 | ||||
| -rw-r--r-- | src/components/WifiCard.js | 49 |
2 files changed, 58 insertions, 4 deletions
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) => { | |||
| 10 | const encryptionModes = [ | 10 | const encryptionModes = [ |
| 11 | { label: t('wifi.password.encryption.none'), value: '' }, | 11 | { label: t('wifi.password.encryption.none'), value: '' }, |
| 12 | { label: 'WPA/WPA2/WPA3', value: 'WPA' }, | 12 | { label: 'WPA/WPA2/WPA3', value: 'WPA' }, |
| 13 | { label: 'WPA2-EAP', value: 'WPA2-EAP' }, | ||
| 13 | { label: 'WEP', value: 'WEP' }, | 14 | { label: 'WEP', value: 'WEP' }, |
| 14 | ]; | 15 | ]; |
| 15 | 16 | const eapMethods = [{ label: 'PWD', value: 'PWD' }]; | |
| 16 | const langSelectDefaultValue = () => { | 17 | const langSelectDefaultValue = () => { |
| 17 | const t = Translations.filter((t) => t.id === i18n.language); | 18 | const t = Translations.filter((t) => t.id === i18n.language); |
| 18 | if (t.length !== 1) { | 19 | if (t.length !== 1) { |
| @@ -68,6 +69,16 @@ export const Settings = (props) => { | |||
| 68 | options={encryptionModes} | 69 | options={encryptionModes} |
| 69 | onChange={(e) => props.onEncryptionModeChange(e.target.value)} | 70 | onChange={(e) => props.onEncryptionModeChange(e.target.value)} |
| 70 | /> | 71 | /> |
| 72 | <RadioGroup | ||
| 73 | label={t('wifi.encryption.eapMethod')} | ||
| 74 | size={16} | ||
| 75 | value={props.settings.eapMethod} | ||
| 76 | options={eapMethods} | ||
| 77 | className={` | ||
| 78 | ${props.settings.encryptionMode !== 'WPA2-EAP' && 'hidden'} | ||
| 79 | `} | ||
| 80 | onChange={(e) => props.onEapMethodChange(e.target.value)} | ||
| 81 | /> | ||
| 71 | </Pane> | 82 | </Pane> |
| 72 | ); | 83 | ); |
| 73 | }; | 84 | }; |
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) => { | |||
| 37 | const password = !props.settings.encryptionMode | 37 | const password = !props.settings.encryptionMode |
| 38 | ? '' | 38 | ? '' |
| 39 | : escape(props.settings.password); | 39 | : escape(props.settings.password); |
| 40 | setQrvalue( | 40 | const qrval = |
| 41 | `WIFI:T:${props.settings.encryptionMode};S:${ssid};P:${password};H:${props.settings.hiddenSSID};` | 41 | props.settings.encryptionMode === 'WPA2-EAP' |
| 42 | ); | 42 | ? `WIFI:T:${props.settings.encryptionMode};S:${ssid};P:${password};H:${props.settings.hiddenSSID};E:${props.settings.eapMethod};I:${props.settings.eapIdentity};;` |
| 43 | : `WIFI:T:${props.settings.encryptionMode};S:${ssid};P:${password};H:${props.settings.hiddenSSID};;`; | ||
| 44 | setQrvalue(qrval); | ||
| 43 | }, [props.settings]); | 45 | }, [props.settings]); |
| 44 | 46 | ||
| 45 | const portraitWidth = () => { | 47 | const portraitWidth = () => { |
| @@ -53,6 +55,15 @@ export const WifiCard = (props) => { | |||
| 53 | return hiddenPassword ? '' : t('wifi.password'); | 55 | return hiddenPassword ? '' : t('wifi.password'); |
| 54 | }; | 56 | }; |
| 55 | 57 | ||
| 58 | const eapIdentityFieldLabel = () => { | ||
| 59 | const hiddenIdentity = props.settings.encryptionMode !== 'WPA2-EAP'; | ||
| 60 | return hiddenIdentity ? '' : t('wifi.identity'); | ||
| 61 | }; | ||
| 62 | |||
| 63 | const eapMethodFieldLabel = () => { | ||
| 64 | return !eapIdentityFieldLabel() ? '' : t('wifi.encryption.eapMethod'); | ||
| 65 | }; | ||
| 66 | |||
| 56 | return ( | 67 | return ( |
| 57 | <Pane> | 68 | <Pane> |
| 58 | <Card | 69 | <Card |
| @@ -101,6 +112,38 @@ export const WifiCard = (props) => { | |||
| 101 | validationMessage={!!props.ssidError && props.ssidError} | 112 | validationMessage={!!props.ssidError && props.ssidError} |
| 102 | /> | 113 | /> |
| 103 | <TextareaField | 114 | <TextareaField |
| 115 | id="eapmethod" | ||
| 116 | type="text" | ||
| 117 | marginBottom={5} | ||
| 118 | readOnly={true} | ||
| 119 | spellCheck={false} | ||
| 120 | className={` | ||
| 121 | ${props.settings.encryptionMode !== 'WPA2-EAP' && 'hidden'} | ||
| 122 | `} | ||
| 123 | label={eapMethodFieldLabel()} | ||
| 124 | value={props.settings.eapMethod} | ||
| 125 | /> | ||
| 126 | <TextareaField | ||
| 127 | id="identity" | ||
| 128 | type="text" | ||
| 129 | marginBottom={5} | ||
| 130 | autoComplete="off" | ||
| 131 | autoCorrect="off" | ||
| 132 | autoCapitalize="none" | ||
| 133 | spellCheck={false} | ||
| 134 | className={` | ||
| 135 | ${props.settings.encryptionMode !== 'WPA2-EAP' && 'hidden'} | ||
| 136 | `} | ||
| 137 | label={eapIdentityFieldLabel()} | ||
| 138 | placeholder={t('wifi.identity.placeholder')} | ||
| 139 | value={props.settings.eapIdentity} | ||
| 140 | onChange={(e) => props.onEapIdentityChange(e.target.value)} | ||
| 141 | isInvalid={!!props.eapIdentityError} | ||
| 142 | validationMessage={ | ||
| 143 | !!props.eapIdentityError && props.eapIdentityError | ||
| 144 | } | ||
| 145 | /> | ||
| 146 | <TextareaField | ||
| 104 | id="password" | 147 | id="password" |
| 105 | type="text" | 148 | type="text" |
| 106 | maxLength="63" | 149 | maxLength="63" |
