diff --git a/src/main/java/envoy/client/ui/controller/LoginScene.java b/src/main/java/envoy/client/ui/controller/LoginScene.java index b17fa81..5c6fab9 100644 --- a/src/main/java/envoy/client/ui/controller/LoginScene.java +++ b/src/main/java/envoy/client/ui/controller/LoginScene.java @@ -23,6 +23,7 @@ import envoy.event.EventBus; import envoy.event.HandshakeRejection; import envoy.event.MessageStatusChange; import envoy.exception.EnvoyException; +import envoy.util.Bounds; import envoy.util.EnvoyLog; /** @@ -115,8 +116,11 @@ public final class LoginScene { if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) { new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait(); repeatPasswordField.clear(); - } - else performHandshake( + } else if (!Bounds.isValidContactName(userTextField.getText())) { + new Alert(AlertType.ERROR, "The entered user name is not valid (" + Bounds.CONTACT_NAME_PATTERN.toString() + ")").showAndWait(); + userTextField.clear(); + } else + performHandshake( new LoginCredentials(userTextField.getText(), passwordField.getText().toCharArray(), registerCheckBox.isSelected(), Startup.VERSION)); }