|
|
@@ -1,19 +1,32 @@ |
|
|
|
import java.io.InputStream; |
|
|
|
import java.util.Scanner; |
|
|
|
|
|
|
|
public class Main { |
|
|
|
public static void main(String[] args) { |
|
|
|
Scanner s = new Scanner(System.in); |
|
|
|
System.out.print("Benutzername: "); |
|
|
|
String login = s.next(); |
|
|
|
System.out.print("Passwort: "); |
|
|
|
String passwort = s.next(); |
|
|
|
s.close(); |
|
|
|
if(login(System.in)) { |
|
|
|
System.out.println("Hello World"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean login(InputStream in) { |
|
|
|
Scanner s = new Scanner(in); |
|
|
|
|
|
|
|
|
|
|
|
Credentials cred = new Credentials(login, passwort); |
|
|
|
if (cred.valid()) { |
|
|
|
System.out.print("Hello World"); |
|
|
|
System.exit(0); |
|
|
|
for (int i = 0; i < 3; i++) { |
|
|
|
System.out.print("Benutzername: "); |
|
|
|
String login = s.next(); |
|
|
|
System.out.print("Passwort: "); |
|
|
|
String passwort = s.next(); |
|
|
|
|
|
|
|
Credentials cred = new Credentials(login, passwort); |
|
|
|
|
|
|
|
if (cred.valid()) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
System.out.println("Du kommst hier nicht rein"); |
|
|
|
} |
|
|
|
System.out.print("Du kommst hier nicht rein"); |
|
|
|
s.close(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |