ppp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Credentials.java 748B

123456789101112131415161718192021222324252627282930313233343536
  1. import org.junit.jupiter.api.Test;
  2. public class Credentials {
  3. private String login;
  4. private String hash;
  5. public Credentials(String login, String password) {
  6. this.hash = Helpers.getHash(password);
  7. System.out.println(hash);
  8. this.login = login;
  9. }
  10. public boolean valid() {
  11. boolean usernameGiven = false;
  12. String hashData;
  13. //iterator over file
  14. for (String line:
  15. Helpers.readTextdatei("data/passwd.txt")) {
  16. if(login == line) {
  17. usernameGiven = true;
  18. continue;
  19. }
  20. if(usernameGiven && hash == line) {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. }
  27. @Test