diff --git a/src/main/java/com/example/vpr_javafx/Data.java b/src/main/java/com/example/vpr_javafx/Data.java index 96ab4ce..9c9251f 100644 --- a/src/main/java/com/example/vpr_javafx/Data.java +++ b/src/main/java/com/example/vpr_javafx/Data.java @@ -281,10 +281,13 @@ public class Data { } /** - * The method validates the user input + * The method validates the user input for login * - * @return boolean inputValid - * @author Kevin Maier, Kevin Pfannenstiel + * @param tfPhone Phone number the user typed in + * @param pfPassword Password the user typed in + * @param controller Controller + * @return phoneNumberValid, passwordValid + * @author Kevin Maier, Kevin Pfannenstiel */ public boolean validateData(TextField tfPhone, PasswordField pfPassword, HelloController controller) { @@ -298,8 +301,8 @@ public class Data { String phoneNumber = tfPhone.getText(); String password = pfPassword.getText(); - Pattern phoneNumberPattern = Pattern.compile("[0-9]*"); - Pattern passwordPattern = Pattern.compile("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$"); + Pattern phoneNumberPattern = Pattern.compile("[0-9]*"); // Pattern that requires numbers + Pattern passwordPattern = Pattern.compile("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$"); // Pattern that requires minimum eight characters, at least one letter and one number if (password.isEmpty() || phoneNumber.isEmpty()) { @@ -395,11 +398,18 @@ public class Data { } /** + * The method validates the user input for registration * - * @param tfPhone - * @param pfPassword - * @param controller - * @author Kevin Maier + * @param tfName The name the user typed in + * @param tfPhone The phone number the user typed in + * @param pfPassword The password the user typed in + * @param tfStreet The street name the user typed in + * @param tfHouseNumber The house number the user typed in + * @param tfPostalCode The postal code the user typed in + * @param tfCity The city the user typed in + * @param tfChild The child the user typed in + * @param controller Controller + * @return phoneNumberValid, passwordValid, postalCodeValid */ public boolean validateRegistration(TextField tfName, TextField tfPhone, PasswordField pfPassword, TextField tfStreet, TextField tfHouseNumber, TextField tfPostalCode, TextField tfCity, TextField tfChild, HelloController controller) { @@ -418,9 +428,9 @@ public class Data { String password = pfPassword.getText(); String postalCode = tfPostalCode.getText(); - Pattern phoneNumberPattern = Pattern.compile("[0-9]*"); - Pattern passwordPattern = Pattern.compile("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$"); - Pattern postalCodePattern = Pattern.compile("[0-9]{5}"); + Pattern phoneNumberPattern = Pattern.compile("[0-9]*"); // Pattern that requires numbers + Pattern passwordPattern = Pattern.compile("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$"); // Pattern that requires minimum eight characters, at least one letter and one number + Pattern postalCodePattern = Pattern.compile("[0-9]{5}"); // Pattern that requires 5 numbers if (tfName.getText().isEmpty() || tfPhone.getText().isEmpty() || pfPassword.getText().isEmpty() || tfStreet.getText().isEmpty() || tfHouseNumber.getText().isEmpty() || tfPostalCode.getText().isEmpty() || tfCity.getText().isEmpty() || tfChild.getText().isEmpty()) {