diff --git a/out/production/VPR_SCRIPT/Data.class b/out/production/VPR_SCRIPT/Data.class index 54ef9a1..b6b12b9 100644 Binary files a/out/production/VPR_SCRIPT/Data.class and b/out/production/VPR_SCRIPT/Data.class differ diff --git a/out/production/VPR_SCRIPT/Execute.class b/out/production/VPR_SCRIPT/Execute.class index 05a5928..4911859 100644 Binary files a/out/production/VPR_SCRIPT/Execute.class and b/out/production/VPR_SCRIPT/Execute.class differ diff --git a/out/production/VPR_SCRIPT/GeneralMethods.class b/out/production/VPR_SCRIPT/GeneralMethods.class index 3aebd84..2332b31 100644 Binary files a/out/production/VPR_SCRIPT/GeneralMethods.class and b/out/production/VPR_SCRIPT/GeneralMethods.class differ diff --git a/src/Execute.java b/src/Execute.java index bd01490..06c0bd9 100644 --- a/src/Execute.java +++ b/src/Execute.java @@ -28,73 +28,28 @@ public class Execute { System.out.println(""); System.out.println("____________________________LOGIN_______________________________"); - System.out.println(""); - System.out.println("Bitte einloggen"); Data userData = new Data("user.txt"); Login login = new Login(); Scanner leser = new Scanner(System.in); + System.out.println(""); + System.out.println("Bitte einloggen"); System.out.print("Telefonnummer: "); String phoneNumber = leser.nextLine(); System.out.print("Passwort: "); String password = leser.nextLine(); + + while(password.isEmpty() || phoneNumber.isEmpty()) + { + System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut."); + System.out.println(""); + System.out.print("Telefonnummer: "); + phoneNumber = leser.nextLine(); + System.out.print("Passwort: "); + password = leser.nextLine(); + } + login.Einloggen(userData.readUser(), password, phoneNumber); } - - //EXECUTE LOGIN -// Data datei = new Data("users.txt"); -// ArrayList user = datei.readUser(); -// -// for (User user1 : user) { -// System.out.println(user1); -// } -// System.out.println(); -// System.out.println("\t\t\tANMELDUNG"); -// int i = 0; -// Scanner leser = new Scanner(System.in); -// -// while (true) { -// -// -// System.out.print("Name: "); -// boolean error = false; -// String name = leser.nextLine(); -// error = isError(error, name); -// System.out.print("Passwort: "); -// String password = leser.nextLine(); -// error = isError(error, password); -// -// -// for (User user1 : user) { -// if (!error) { -// if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(name)) { -// System.out.println(); -// System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!"); -// -// i++; -// break; -// -// } else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(name))) { -// System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut."); -// break; -// } -// -// }else{ -// System.out.println("Bitte Anmeldedaten angeben."); -// break; -// } -// } -// if (i > 0) { -// break; -// } -// } -// } -// -// private static boolean isError(boolean error, String name) { -// if (name.isEmpty()) { -// error = true; -// } -// return error; -// } } diff --git a/src/Login.java b/src/Login.java index 36b1f42..aa6ec90 100644 --- a/src/Login.java +++ b/src/Login.java @@ -6,48 +6,45 @@ public class Login { Scanner leser = new Scanner(System.in); - System.out.println(); - int i = 0; + System.out.println(); + int i = 0; - while (true) { + while (true) { - boolean error = false; - error = isError(error, phoneNumber); + boolean error = false; + error = isError(error, phoneNumber); - for (User user1 : user) { - if (!error) { - if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber)) - { - System.out.println(""); - System.out.println("\t\t\tANMELDUNG"); - System.out.println(); - System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!"); - i++; - break; - } - else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber))) - { - System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut."); - System.out.println(""); - System.out.print("Telefonnummer: "); - phoneNumber = leser.nextLine(); - System.out.print("Passwort: "); - password = leser.nextLine(); - break; - } + for (User user1 : user) { + if (!error) { + if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber)) { + System.out.println(""); + System.out.println("\t\t\tANMELDUNG"); + System.out.println(); + System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!"); + i++; + break; + } + else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber))) { + System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut."); + System.out.println(""); + System.out.print("Telefonnummer: "); + phoneNumber = leser.nextLine(); + System.out.print("Passwort: "); + password = leser.nextLine(); + break; } } - if (i > 0) { - break; - } + } + if (i > 0) { + break; } } - - public boolean isError ( boolean error, String phoneNumber) - { - if (phoneNumber.isEmpty()) { - error = true; } + + public boolean isError(boolean error, String phoneNumber) { + if (phoneNumber.isEmpty()) { + error = true; + } return error; } }