12345678910111213141516171819202122232425262728293031323334 |
- import org.junit.jupiter.api.Test;
-
- public class Credentials {
-
- private String login;
- private String hash;
-
- public Credentials(String login, String password) {
- this.hash = Helpers.getHash(password);
- this.login = login;
- }
-
- public boolean valid() {
-
- boolean usernameGiven = false;
-
-
- //iterator over file
- for (String line:
- Helpers.readTextdatei("data/passwd.txt")) {
- if(login.equals(line)) {
- usernameGiven = true;
- continue;
- }
- if(usernameGiven && hash.equals(line)) {
- return true;
- }
-
- }
- return false;
- }
- }
-
|