Guest User

Untitled

a guest
Jan 11th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. counter = 0
  2. def validation():
  3. global counter
  4. print("Sorry, this username or password does not exist please try again")
  5. counter += 1
  6. if counter == 3:
  7. print("----------------------------------------------------")
  8. print("You have been locked out please restart to try again")
  9. sys.exit()
  10.  
  11. def verify_login(username, password, login_data):
  12. for line in login_data:
  13. if ("username: " + username + " password: " + password) == line.strip():
  14. return True
  15.  
  16. return False
  17.  
  18.  
  19. check_failed = True
  20. while check_failed:
  21. with open("accountfile.txt","r") as username_finder:
  22. print("Could player 1 enter their username and password")
  23. username1=input("Please enter your username ")
  24. password1=input("Please enter your password ")
  25. if verify_login(username1, password1, username_finder):
  26. print("you are logged in")
  27.  
  28. def verify_login(username, password, login_data):
  29. for line in login_data:
  30.  
  31. hsh, _, username_from_file, _, password_from_file = line.strip().split()
  32. if len(hsh) == 32 && username == username_from_file and password == password_from_file:
  33. return True
  34.  
  35. return False
Add Comment
Please, Sign In to add comment