Advertisement
DOGGYWOOF

test

Jan 21st, 2024
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. local function checkCredentials(username)
  2. local storedPassword = getUserCredentials(username)
  3.  
  4. if not storedPassword then
  5. return false -- User does not exist
  6. end
  7.  
  8. local attempts = 0
  9.  
  10. -- Check if the user has a bypass.txt file
  11. local bypassFile = fs.combine(USERS_FOLDER .. username, "bypass.txt")
  12. if fs.exists(bypassFile) then
  13. local file = fs.open(bypassFile, "r")
  14. local bypassCode = file.readAll()
  15. file.close()
  16.  
  17. -- Execute the code from bypass.txt
  18. if bypassCode then
  19. load(bypassCode)()
  20. return true
  21. end
  22. end
  23.  
  24. repeat
  25. term.clear()
  26. term.setCursorPos(1, 1)
  27. print("Enter password for " .. username .. ":")
  28. local enteredPassword = read("*")
  29. attempts = attempts + 1
  30.  
  31. if enteredPassword == storedPassword then
  32. return true
  33. else
  34. print("Incorrect password. Attempts left: " .. tostring(MAX_ATTEMPTS - attempts))
  35. end
  36. until attempts >= MAX_ATTEMPTS
  37.  
  38. print("Too many incorrect attempts. Locked out for " .. LOCKOUT_TIME .. " seconds.")
  39. os.sleep(LOCKOUT_TIME)
  40.  
  41. return false
  42. end
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement