Validate user name during login and registration
This commit is contained in:
parent
961527e663
commit
55066f2cb8
@ -23,6 +23,7 @@ import envoy.event.EventBus;
|
|||||||
import envoy.event.HandshakeRejection;
|
import envoy.event.HandshakeRejection;
|
||||||
import envoy.event.MessageStatusChange;
|
import envoy.event.MessageStatusChange;
|
||||||
import envoy.exception.EnvoyException;
|
import envoy.exception.EnvoyException;
|
||||||
|
import envoy.util.Bounds;
|
||||||
import envoy.util.EnvoyLog;
|
import envoy.util.EnvoyLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,8 +116,11 @@ public final class LoginScene {
|
|||||||
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
|
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
|
||||||
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();
|
||||||
repeatPasswordField.clear();
|
repeatPasswordField.clear();
|
||||||
}
|
} else if (!Bounds.isValidContactName(userTextField.getText())) {
|
||||||
else performHandshake(
|
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));
|
new LoginCredentials(userTextField.getText(), passwordField.getText().toCharArray(), registerCheckBox.isSelected(), Startup.VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user