Merge pull request #153 from informatik-ag-ngl/b/annoying_registration
Make Registration less annoying
This commit is contained in:
commit
9dc8ad5ca0
@ -71,9 +71,7 @@ public final class LoginScene {
|
|||||||
connectionLabel.setText("Server: " + config.getServer() + ":" + config.getPort());
|
connectionLabel.setText("Server: " + config.getServer() + ":" + config.getPort());
|
||||||
|
|
||||||
// Show an alert after an unsuccessful handshake
|
// Show an alert after an unsuccessful handshake
|
||||||
eventBus.register(
|
eventBus.register(HandshakeRejection.class, e -> Platform.runLater(() -> { new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
|
||||||
HandshakeRejection.class,
|
|
||||||
e -> Platform.runLater(() -> { clearPasswordFields(); new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,9 +115,10 @@ public final class LoginScene {
|
|||||||
|
|
||||||
// Prevent registration with unequal passwords
|
// Prevent registration with unequal passwords
|
||||||
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
|
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
|
||||||
clearPasswordFields();
|
|
||||||
new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait();
|
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));
|
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
|
// Make repeat password field and label visible / invisible
|
||||||
repeatPasswordField.setVisible(registerCheckBox.isSelected());
|
repeatPasswordField.setVisible(registerCheckBox.isSelected());
|
||||||
repeatPasswordLabel.setVisible(registerCheckBox.isSelected());
|
repeatPasswordLabel.setVisible(registerCheckBox.isSelected());
|
||||||
clearPasswordFields();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -214,9 +212,4 @@ public final class LoginScene {
|
|||||||
if (receivedMessageCache != null && client.isOnline()) receivedMessageCache.relay();
|
if (receivedMessageCache != null && client.isOnline()) receivedMessageCache.relay();
|
||||||
if (receivedMessageStatusChangeCache != null && client.isOnline()) receivedMessageStatusChangeCache.relay();
|
if (receivedMessageStatusChangeCache != null && client.isOnline()) receivedMessageStatusChangeCache.relay();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearPasswordFields() {
|
|
||||||
passwordField.clear();
|
|
||||||
repeatPasswordField.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
</padding></PasswordField>
|
</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>
|
<GridPane.margin>
|
||||||
<Insets bottom="5.0" left="5.0" right="5.0" top="10.0" />
|
<Insets bottom="5.0" left="5.0" right="5.0" top="10.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
|
Reference in New Issue
Block a user