Kommentare ergänzt
This commit is contained in:
parent
1e6d13698f
commit
f1db5ecca9
@ -6,9 +6,7 @@ import javafx.scene.control.Alert;
|
|||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import javafx.scene.control.PasswordField;
|
import javafx.scene.control.PasswordField;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import org.w3c.dom.Text;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -288,12 +286,12 @@ public class Data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The method validates the user input
|
* The method validates the user input for login
|
||||||
*
|
*
|
||||||
* @param tfPhone Phone number the user typed in
|
* @param tfPhone Phone number the user typed in
|
||||||
* @param pfPassword Password the user typed in
|
* @param pfPassword Password the user typed in
|
||||||
* @param controller Controller
|
* @param controller Controller
|
||||||
* @return phoneNumberValid && passwordValid
|
* @return phoneNumberValid, passwordValid
|
||||||
* @author Kevin Maier, Kevin Pfannenstiel
|
* @author Kevin Maier, Kevin Pfannenstiel
|
||||||
*/
|
*/
|
||||||
public boolean validateData(TextField tfPhone, PasswordField pfPassword, HelloController controller)
|
public boolean validateData(TextField tfPhone, PasswordField pfPassword, HelloController controller)
|
||||||
@ -310,8 +308,8 @@ public class Data {
|
|||||||
String phoneNumber = tfPhone.getText();
|
String phoneNumber = tfPhone.getText();
|
||||||
String password = pfPassword.getText();
|
String password = pfPassword.getText();
|
||||||
|
|
||||||
Pattern phoneNumberPattern = Pattern.compile("[0-9]*");
|
Pattern phoneNumberPattern = Pattern.compile("[0-9]*"); // Pattern that requires just numbers
|
||||||
Pattern passwordPattern = Pattern.compile("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$");
|
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())
|
if (password.isEmpty() || phoneNumber.isEmpty())
|
||||||
{
|
{
|
||||||
@ -349,12 +347,20 @@ public class Data {
|
|||||||
return phoneNumberValid && passwordValid;
|
return phoneNumberValid && passwordValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The method validates the user input for registration
|
||||||
*
|
*
|
||||||
* @param tfPhone
|
* @param tfName The name the user typed in
|
||||||
* @param pfPassword
|
* @param tfPhone The phone number the user typed in
|
||||||
* @param controller
|
* @param pfPassword The password the user typed in
|
||||||
* @author Kevin Maier
|
* @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)
|
public boolean validateRegistration(TextField tfName, TextField tfPhone, PasswordField pfPassword, TextField tfStreet, TextField tfHouseNumber, TextField tfPostalCode, TextField tfCity, TextField tfChild, HelloController controller)
|
||||||
{
|
{
|
||||||
@ -373,9 +379,9 @@ public class Data {
|
|||||||
String password = pfPassword.getText();
|
String password = pfPassword.getText();
|
||||||
String postalCode = tfPostalCode.getText();
|
String postalCode = tfPostalCode.getText();
|
||||||
|
|
||||||
Pattern phoneNumberPattern = Pattern.compile("[0-9]*");
|
Pattern phoneNumberPattern = Pattern.compile("[0-9]*"); // Pattern that requires just numbers
|
||||||
Pattern passwordPattern = Pattern.compile("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$");
|
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 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())
|
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())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user