Compare commits
4 Commits
044f64635b
...
2d683b9cc6
Author | SHA1 | Date | |
---|---|---|---|
2d683b9cc6 | |||
739e973cf7 | |||
487bdd8fe0 | |||
c526229de9 |
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
Binary file not shown.
Binary file not shown.
@ -25,6 +25,27 @@ public class Execute {
|
|||||||
+ "i: Sesam; j: Schwefeldioxid und Sulfit; k: Nüsse; l: Sellerie; m: Fische; n: Lupinen\n"
|
+ "i: Sesam; j: Schwefeldioxid und Sulfit; k: Nüsse; l: Sellerie; m: Fische; n: Lupinen\n"
|
||||||
+ "1: Nitrit-Pökelsalz; 2: Phosphat; 3: Nitrat; 4: Antioxidationsmittel; 5: Farbstoff;\n"
|
+ "1: Nitrit-Pökelsalz; 2: Phosphat; 3: Nitrat; 4: Antioxidationsmittel; 5: Farbstoff;\n"
|
||||||
+ "6: Geschmacksverstärker; 7: Süßungsmittel; 8: Konservierungsstoff");
|
+ "6: Geschmacksverstärker; 7: Süßungsmittel; 8: Konservierungsstoff");
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
System.out.print("Telefonnummer: ");
|
||||||
|
String phoneNumber = leser.nextLine();
|
||||||
|
System.out.print("Passwort: ");
|
||||||
|
String password = leser.nextLine();
|
||||||
|
login.Einloggen(userData.readUser(), password, phoneNumber);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//EXECUTE LOGIN
|
//EXECUTE LOGIN
|
||||||
|
45
src/Login.java
Normal file
45
src/Login.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Login {
|
||||||
|
public void Einloggen(ArrayList<User> user, String password, String phoneNumber) {
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("\t\t\tANMELDUNG");
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
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("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.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i > 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isError ( boolean error, String phoneNumber)
|
||||||
|
{
|
||||||
|
if (phoneNumber.isEmpty()) {
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user