Merge remote-tracking branch 'origin/develop' into f/enhanced_UI

This commit is contained in:
delvh 2020-06-25 10:45:37 +02:00
commit d80bc39221
2 changed files with 5 additions and 12 deletions

View File

@ -71,9 +71,7 @@ public final class LoginScene {
connectionLabel.setText("Server: " + config.getServer() + ":" + config.getPort());
// Show an alert after an unsuccessful handshake
eventBus.register(
HandshakeRejection.class,
e -> Platform.runLater(() -> { clearPasswordFields(); new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
eventBus.register(HandshakeRejection.class, e -> Platform.runLater(() -> { new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
}
/**
@ -117,9 +115,10 @@ public final class LoginScene {
// Prevent registration with unequal passwords
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
clearPasswordFields();
new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait();
} else performHandshake(
repeatPasswordField.clear();
}
else performHandshake(
new LoginCredentials(userTextField.getText(), passwordField.getText().toCharArray(), registerCheckBox.isSelected(), Startup.VERSION));
}
@ -134,7 +133,6 @@ public final class LoginScene {
// Make repeat password field and label visible / invisible
repeatPasswordField.setVisible(registerCheckBox.isSelected());
repeatPasswordLabel.setVisible(registerCheckBox.isSelected());
clearPasswordFields();
}
@FXML
@ -214,9 +212,4 @@ public final class LoginScene {
if (receivedMessageCache != null && client.isOnline()) receivedMessageCache.relay();
if (receivedMessageStatusChangeCache != null && client.isOnline()) receivedMessageStatusChangeCache.relay();
}
private void clearPasswordFields() {
passwordField.clear();
repeatPasswordField.clear();
}
}

View File

@ -72,7 +72,7 @@
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding></PasswordField>
<PasswordField fx:id="repeatPasswordField" promptText="Repeat the chosen password" visible="false" GridPane.columnIndex="1" GridPane.rowIndex="2">
<PasswordField fx:id="repeatPasswordField" visible="false" GridPane.columnIndex="1" GridPane.rowIndex="2">
<GridPane.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="10.0" />
</GridPane.margin>