From de77901f5a284185e07154db4f777a7b94acf2c8 Mon Sep 17 00:00:00 2001 From: Kevin Pfannenstiel Date: Wed, 21 Dec 2022 08:28:06 +0100 Subject: [PATCH] Login aktualisiert! --- out/production/VPR_SCRIPT/Data.class | Bin 4869 -> 4864 bytes out/production/VPR_SCRIPT/Execute.class | Bin 2311 -> 2540 bytes .../VPR_SCRIPT/GeneralMethods.class | Bin 1420 -> 1420 bytes src/Execute.java | 71 ++++-------------- src/Login.java | 65 ++++++++-------- 5 files changed, 44 insertions(+), 92 deletions(-) diff --git a/out/production/VPR_SCRIPT/Data.class b/out/production/VPR_SCRIPT/Data.class index 54ef9a1f9c13a9b92eb7edcc92961db3b252c6e4..b6b12b9a856792b3201419b8310d1584846570b4 100644 GIT binary patch delta 575 zcmXBQT};hk9KiAK?>RdCYiYDHXM{7Hq^sjb9G&UKOoTKqAxRz9p&X~ADVHyDYIjG|Y~{8DE9k4J8a+l@?0HF6jqa9J*VPN@5wA5NadhJGdg2L3R@x{1?~>!c z8+ST!Okph3n1vHJ)0xW*a+pazE|!qN3Z1MblNx3dAS;@gSZfPqYc@}_1v>Of^J=DNw_hAH5tDWS)dbIa6n$JBGz*xWN6^oGZy`(*uN z+&odhegzy*z(EBZQoyGQIIMKfljczAeDtav7v%{%7t f-u^hZ)B8!MDPsA8mv1cMD~p-dul;Vf#RUHX0m_UM diff --git a/out/production/VPR_SCRIPT/Execute.class b/out/production/VPR_SCRIPT/Execute.class index 05a5928606fe5a6eb5f0688ec7c5a135a3d5ea2d..4911859f78c42f82de6716e04548939a8e73993a 100644 GIT binary patch delta 776 zcmX|QFxn&;|VK310GGI6EaGD$AdI+!Z~DA?2FPI#7m2!w5oY9HWrH{ zh9gbZNXBlnQ)X=FKy`@wjO@(?+$5I?s%)Q)lVXoD0&+c|~Ck zBN?;e5dlb8afME#qeCP1gu+u*-R&o)2@4t1ERbf#~>v_fqO znUxNiDa*{*;Q*SxAeSgo_=VM_c3IHfs6R+Nj{)b4(V_-l?)Q!=*)iih^HuaD$P-Br zD-z%nds(80cqQJuV-dBGD<{ReWn{>Z*x*_N7Q+&)V}w!3$l<(R4E&%rI+c1RvV`s` zKDLw zIa_%}CChB%9ot!+;+X;g{vNm||KKUZIs4`O-pnP31L^ vTLN-hGPU?tDbi?7iTX+74+?+FmHRb!){;5fpowbE$_oX%g~?qxn#b%Pv>T%C delta 541 zcmXAl%TE(w6vcnT%=8=TM4Ym57ESSih*7&W1dJk5A3#lviPeIRFx0_1l`=(q65SXR zH)fW^ohw&>u{Ac4rHP3w-0H%OJO2Vrh<9Lf&v(zg-#I7uPxp&V`s>!G&%hANYw6#5 zv1>SpBEQEE!fLHj@k5I<8dhV$uOE+=BE?w^bF5Yg!Zai3igOyyoVV!Z8&OcrU!L~D z(64vma>3>zV{yNcvkFYum=xnnMmBzK^l63oopCU$xNcL%5&gRF&0GWVz20sgq)`n+Nh# kJQS(q5IZ7|MC7qB8T2h2g;I2D{}}zt9@%*!lMbH#2g0Lh?EnA( diff --git a/out/production/VPR_SCRIPT/GeneralMethods.class b/out/production/VPR_SCRIPT/GeneralMethods.class index 3aebd846fe5353978c6e21fd3d1747412bd4f589..2332b31ca6f891ff6a46ff71a8405fd7d83ecdd2 100644 GIT binary patch delta 85 zcmWN{!3jWM0D#f&fc_Fu6bB&`Cn6$b7=u{A%?37br3_#w@y>5mS5-Xkc?07icFFWn n2+#?!h;WIwOIorVnF2wHMukC*O@l*=NB94pgn^W4o8{~Sy^#%J delta 85 zcmV~$O$tCj0D#eNfu=+h#X=!dEQ!cpIg5k1!0g<>4Qwd~a430CnaULJcRj#(ibHc_ n3=(WoJTgM$ersD%qEjKLv1o8;@#zTYi5Q5Pkj&&P`>Gc|z?BVq 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; } }