@@ -7,17 +7,30 @@ public class Credentials { | |||
public Credentials(String login, String password) { | |||
this.hash = Helpers.getHash(password); | |||
System.out.println(hash); | |||
this.login = login; | |||
} | |||
public boolean valid() { | |||
boolean usernameGiven = false; | |||
String hashData; | |||
//iterator over file | |||
for (String line: | |||
Helpers.readTextdatei("data/passwd.txt")) { | |||
System.out.println(line); | |||
if(login == line) { | |||
usernameGiven = true; | |||
continue; | |||
} | |||
if(usernameGiven && hash == line) { | |||
return true; | |||
} | |||
} | |||
return false; | |||
} | |||
} | |||
@Test | |||