Skip to content

Commit 9893975

Browse files
authored
fix: generic error when setting access point with no password (#17)
* fix: removed placeholder for empty passwords Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com> * fix: added fix for none security Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com> * refactor: implemented a more simple solution Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com> * fix: mandatory conditional validation Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com> --------- Signed-off-by: SimoneFiorani <simone.fiorani@abinsula.com>
1 parent 80a4280 commit 9893975

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

bundles/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/client/ui/network/TabWirelessUi.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ private void initForm() {
935935
});
936936

937937
this.password.addBlurHandler(e -> this.password.validate());
938-
this.password.setAllowBlank(false);
938+
this.password.setAllowBlank(true);
939939
this.password.addMouseOutHandler(event -> resetHelp());
940940

941941
this.buttonPassword.addClickHandler(event -> {
@@ -1300,6 +1300,8 @@ private void setPasswordValidation() {
13001300
this.password.setValidatorsFrom(Optional.empty(), passwordStrengthRequirements);
13011301
this.password
13021302
.addValidator(GwtValidators.regex(REGEX_PASS_WEP, MSGS.netWifiWirelessInvalidWEPPassword()));
1303+
} else if (this.security != null && this.security.getSelectedItemText().equals(WIFI_SECURITY_NONE_MESSAGE)) {
1304+
this.password.setValidators();
13031305
} else {
13041306
passwordStrengthRequirements.allowAnyPassword();
13051307
this.password.setValidatorsFrom(Optional.empty(), passwordStrengthRequirements);
@@ -1716,6 +1718,7 @@ private boolean checkPassword() {
17161718
this.groupPassword.setValidationState(ValidationState.ERROR);
17171719
result = false;
17181720
} else {
1721+
TabWirelessUi.this.helpPassword.setText("");
17191722
this.groupPassword.setValidationState(ValidationState.NONE);
17201723
}
17211724

bundles/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/net2/configuration/NetworkConfigurationServicePropertiesBuilder.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.eclipse.kura.web.shared.model.GwtNetRouterMode;
3131
import org.eclipse.kura.web.shared.model.GwtWifiConfig;
3232
import org.eclipse.kura.web.shared.model.GwtWifiNetInterfaceConfig;
33+
import org.eclipse.kura.web.shared.model.GwtWifiSecurity;
3334
import org.slf4j.Logger;
3435
import org.slf4j.LoggerFactory;
3536

@@ -234,7 +235,9 @@ private void setWifiMasterProperties() throws GwtKuraException {
234235

235236
this.properties.setWifiMasterPassphrase(this.ifname, gwtApConfig.getPassword());
236237
} else {
237-
GwtServerUtil.validateUserPassword(Optional.empty(), gwtWifiConfig.getPassword());
238+
if (!gwtWifiConfig.getSecurity().equals(GwtWifiSecurity.netWifiSecurityNONE.name())) {
239+
GwtServerUtil.validateUserPassword(Optional.empty(), gwtWifiConfig.getPassword());
240+
}
238241
this.properties.setWifiMasterPassphrase(this.ifname, gwtWifiConfig.getPassword());
239242
}
240243
}

bundles/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/server/util/GwtServerUtil.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,16 +771,19 @@ public static List<GwtNetInterfaceConfig> replaceNetworkConfigListSensitivePassw
771771
if (netConfig instanceof GwtWifiNetInterfaceConfig) {
772772
GwtWifiNetInterfaceConfig wifiConfig = (GwtWifiNetInterfaceConfig) netConfig;
773773
GwtWifiConfig gwtAPWifiConfig = wifiConfig.getAccessPointWifiConfig();
774-
if (gwtAPWifiConfig != null) {
774+
if (gwtAPWifiConfig != null && gwtAPWifiConfig.getPassword() != null
775+
&& !gwtAPWifiConfig.getPassword().isEmpty()) {
775776
gwtAPWifiConfig.setPassword(PASSWORD_PLACEHOLDER);
776777
}
777778

778779
GwtWifiConfig gwtStationWifiConfig = wifiConfig.getStationWifiConfig();
779-
if (gwtStationWifiConfig != null) {
780+
if (gwtStationWifiConfig != null && gwtStationWifiConfig.getPassword() != null
781+
&& !gwtStationWifiConfig.getPassword().isEmpty()) {
780782
gwtStationWifiConfig.setPassword(PASSWORD_PLACEHOLDER);
781783
}
782784
Gwt8021xConfig gwt8021xConfig = wifiConfig.get8021xConfig();
783-
if (gwt8021xConfig != null) {
785+
if (gwt8021xConfig != null && gwt8021xConfig.getPassword() != null
786+
&& !gwt8021xConfig.getPassword().isEmpty()) {
784787
gwt8021xConfig.setPassword(PASSWORD_PLACEHOLDER);
785788
}
786789

0 commit comments

Comments
 (0)