diff --git a/src/main/java/envoy/client/ui/controller/LoginScene.java b/src/main/java/envoy/client/ui/controller/LoginScene.java
index 13fc564..2435980 100644
--- a/src/main/java/envoy/client/ui/controller/LoginScene.java
+++ b/src/main/java/envoy/client/ui/controller/LoginScene.java
@@ -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(); }));
}
/**
@@ -116,10 +114,9 @@ public final class LoginScene {
private void loginButtonPressed() {
// Prevent registration with unequal passwords
- if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
- clearPasswordFields();
+ if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText()))
new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait();
- } else performHandshake(
+ else performHandshake(
new LoginCredentials(userTextField.getText(), passwordField.getText().toCharArray(), registerCheckBox.isSelected(), Startup.VERSION));
}
@@ -134,7 +131,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 +210,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();
- }
}
diff --git a/src/main/resources/fxml/LoginScene.fxml b/src/main/resources/fxml/LoginScene.fxml
index e108008..add7540 100644
--- a/src/main/resources/fxml/LoginScene.fxml
+++ b/src/main/resources/fxml/LoginScene.fxml
@@ -72,7 +72,7 @@
-
+