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/App.js | |
| parent | eba3c1a6629e832db1da713825043d162bec9d28 (diff) | |
Add support for EAP-PWD (#246)
I also added a German translation of the new strings.
Diffstat (limited to 'src/App.js')
| -rw-r--r-- | src/App.js | 35 |
1 files changed, 35 insertions, 0 deletions
| @@ -18,6 +18,10 @@ function App() { | |||
| 18 | password: '', | 18 | password: '', |
| 19 | // Settings: Network encryption mode | 19 | // Settings: Network encryption mode |
| 20 | encryptionMode: 'WPA', | 20 | encryptionMode: 'WPA', |
| 21 | // Settings: EAP Method | ||
| 22 | eapMethod: 'PWD', | ||
| 23 | // Settings: EAP identity | ||
| 24 | eapIdentity: '', | ||
| 21 | // Settings: Hide password on the printed card | 25 | // Settings: Hide password on the printed card |
| 22 | hidePassword: false, | 26 | hidePassword: false, |
| 23 | // Settings: Mark your network as hidden SSID | 27 | // Settings: Mark your network as hidden SSID |
| @@ -28,6 +32,7 @@ function App() { | |||
| 28 | const [errors, setErrors] = useState({ | 32 | const [errors, setErrors] = useState({ |
| 29 | ssidError: '', | 33 | ssidError: '', |
| 30 | passwordError: '', | 34 | passwordError: '', |
| 35 | eapIdentityError: '', | ||
| 31 | }); | 36 | }); |
| 32 | 37 | ||
| 33 | const htmlDirection = (languageID) => { | 38 | const htmlDirection = (languageID) => { |
| @@ -63,6 +68,26 @@ function App() { | |||
| 63 | }); | 68 | }); |
| 64 | return; | 69 | return; |
| 65 | } | 70 | } |
| 71 | if ( | ||
| 72 | settings.password.length < 1 && | ||
| 73 | settings.encryptionMode === 'WPA2-EAP' | ||
| 74 | ) { | ||
| 75 | setErrors({ | ||
| 76 | ...errors, | ||
| 77 | passwordError: t('wifi.alert.password'), | ||
| 78 | }); | ||
| 79 | return; | ||
| 80 | } | ||
| 81 | if ( | ||
| 82 | settings.eapIdentity.length < 1 && | ||
| 83 | settings.encryptionMode === 'WPA2-EAP' | ||
| 84 | ) { | ||
| 85 | setErrors({ | ||
| 86 | ...errors, | ||
| 87 | eapIdentityError: t('wifi.alert.eapIdentity'), | ||
| 88 | }); | ||
| 89 | return; | ||
| 90 | } | ||
| 66 | document.title = 'WiFi Card - ' + settings.ssid; | 91 | document.title = 'WiFi Card - ' + settings.ssid; |
| 67 | window.print(); | 92 | window.print(); |
| 68 | }; | 93 | }; |
| @@ -79,6 +104,13 @@ function App() { | |||
| 79 | setErrors({ ...errors, passwordError: '' }); | 104 | setErrors({ ...errors, passwordError: '' }); |
| 80 | setSettings({ ...settings, encryptionMode }); | 105 | setSettings({ ...settings, encryptionMode }); |
| 81 | }; | 106 | }; |
| 107 | const onEapMethodChange = (eapMethod) => { | ||
| 108 | setSettings({ ...settings, eapMethod }); | ||
| 109 | }; | ||
| 110 | const onEapIdentityChange = (eapIdentity) => { | ||
| 111 | setErrors({ ...errors, eapIdentityError: '' }); | ||
| 112 | setSettings({ ...settings, eapIdentity }); | ||
| 113 | }; | ||
| 82 | const onOrientationChange = (portrait) => { | 114 | const onOrientationChange = (portrait) => { |
| 83 | setSettings({ ...settings, portrait }); | 115 | setSettings({ ...settings, portrait }); |
| 84 | }; | 116 | }; |
| @@ -125,7 +157,9 @@ function App() { | |||
| 125 | settings={settings} | 157 | settings={settings} |
| 126 | ssidError={errors.ssidError} | 158 | ssidError={errors.ssidError} |
| 127 | passwordError={errors.passwordError} | 159 | passwordError={errors.passwordError} |
| 160 | eapIdentityError={errors.eapIdentityError} | ||
| 128 | onSSIDChange={onSSIDChange} | 161 | onSSIDChange={onSSIDChange} |
| 162 | onEapIdentityChange={onEapIdentityChange} | ||
| 129 | onPasswordChange={onPasswordChange} | 163 | onPasswordChange={onPasswordChange} |
| 130 | /> | 164 | /> |
| 131 | 165 | ||
| @@ -135,6 +169,7 @@ function App() { | |||
| 135 | onFirstLoad={onFirstLoad} | 169 | onFirstLoad={onFirstLoad} |
| 136 | onLanguageChange={onChangeLanguage} | 170 | onLanguageChange={onChangeLanguage} |
| 137 | onEncryptionModeChange={onEncryptionModeChange} | 171 | onEncryptionModeChange={onEncryptionModeChange} |
| 172 | onEapMethodChange={onEapMethodChange} | ||
| 138 | onOrientationChange={onOrientationChange} | 173 | onOrientationChange={onOrientationChange} |
| 139 | onHidePasswordChange={onHidePasswordChange} | 174 | onHidePasswordChange={onHidePasswordChange} |
| 140 | onHiddenSSIDChange={onHiddenSSIDChange} | 175 | onHiddenSSIDChange={onHiddenSSIDChange} |
