1234567891011121314151617181920212223242526272829303132333435 |
- 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;
- String hashData;
-
- //iterator over file
- for (String line:
- Helpers.readTextdatei("data/passwd.txt")) {
- if(login == line) {
- usernameGiven = true;
- continue;
- }
- if(usernameGiven && hash == line) {
- return true;
- }
-
- }
- return false;
- }
- }
-
-
|