Credentials Test
This commit is contained in:
parent
763948e288
commit
6a02be9f2e
@ -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);
|
||||
if(login(System.in)) {
|
||||
System.out.println("Hello World");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean login(InputStream in) {
|
||||
Scanner s = new Scanner(in);
|
||||
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
System.out.print("Benutzername: ");
|
||||
String login = s.next();
|
||||
System.out.print("Passwort: ");
|
||||
String passwort = s.next();
|
||||
s.close();
|
||||
|
||||
Credentials cred = new Credentials(login, passwort);
|
||||
|
||||
if (cred.valid()) {
|
||||
System.out.print("Hello World");
|
||||
System.exit(0);
|
||||
return true;
|
||||
}
|
||||
System.out.print("Du kommst hier nicht rein");
|
||||
|
||||
System.out.println("Du kommst hier nicht rein");
|
||||
}
|
||||
s.close();
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user