Login ist so gut wie fertig!

This commit is contained in:
Kevin Pfannenstiel 2022-12-20 19:41:12 +01:00
parent 2d683b9cc6
commit 76d08d93da
6 changed files with 16 additions and 13 deletions

Binary file not shown.

View File

@ -6,7 +6,7 @@ import java.util.Scanner;
*/ */
public class Execute { public class Execute {
public static void main(String[] args) { public static void main(String[] args) {
//EXECUTE MENUE OVERVIEW //EXECUTE MENU OVERVIEW
Data data = new Data("menue.txt"); Data data = new Data("menue.txt");
ArrayList<Menu> menu = data.readMenu(); ArrayList<Menu> menu = data.readMenu();
@ -33,18 +33,12 @@ public class Execute {
Data userData = new Data("user.txt"); Data userData = new Data("user.txt");
Login login = new Login(); Login login = new Login();
Scanner leser = new Scanner(System.in); Scanner leser = new Scanner(System.in);
while(true)
{
System.out.print("Telefonnummer: "); System.out.print("Telefonnummer: ");
String phoneNumber = leser.nextLine(); String phoneNumber = leser.nextLine();
System.out.print("Passwort: "); System.out.print("Passwort: ");
String password = leser.nextLine(); String password = leser.nextLine();
login.Einloggen(userData.readUser(), password, phoneNumber); login.Einloggen(userData.readUser(), password, phoneNumber);
}
} }

View File

@ -1,10 +1,12 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Scanner;
public class Login { public class Login {
public void Einloggen(ArrayList<User> user, String password, String phoneNumber) { public void Einloggen(ArrayList<User> user, String password, String phoneNumber) {
Scanner leser = new Scanner(System.in);
System.out.println(); System.out.println();
System.out.println("\t\t\tANMELDUNG");
int i = 0; int i = 0;
while (true) { while (true) {
@ -16,6 +18,8 @@ public class Login {
if (!error) { if (!error) {
if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber)) if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber))
{ {
System.out.println("");
System.out.println("\t\t\tANMELDUNG");
System.out.println(); System.out.println();
System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!"); System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!");
i++; i++;
@ -24,6 +28,11 @@ public class Login {
else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber))) else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(phoneNumber)))
{ {
System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut."); 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; break;
} }
} }