Advertisement
DOGGYWOOF

delete after

Jan 26th, 2024 (edited)
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. -- ... (existing code)
  2.  
  3. local function activateUser(username)
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6.  
  7. print("Are you sure you want to activate user " .. username .. "? (yes/no)")
  8. local confirmation = read()
  9.  
  10. if confirmation:lower() == "yes" then
  11. local disabledFile = fs.combine(USERS_FOLDER .. username, "disabled.txt")
  12.  
  13. if fs.exists(disabledFile) then
  14. fs.delete(disabledFile)
  15. print("User activated successfully.")
  16. else
  17. print("User is already active.")
  18. end
  19. else
  20. print("User activation canceled.")
  21. end
  22. end
  23.  
  24. local function main()
  25. local users = fs.list(USERS_FOLDER)
  26.  
  27. if not users or #users == 0 then
  28. -- No users detected, run the BSOD program
  29. shell.run(ERROR_FOLDER .. BSOD_PROGRAM)
  30. else
  31. term.clear()
  32. term.setCursorPos(1, 1)
  33.  
  34. print("Enter username:")
  35. local enteredUsername = read()
  36.  
  37. if checkCredentials(enteredUsername) then
  38. activateUser(enteredUsername) -- New line to activate the user
  39. print("Access granted. Welcome, " .. enteredUsername .. "!")
  40. -- Your main OS code goes here
  41. else
  42. print("Access denied.")
  43. end
  44. end
  45. end
  46.  
  47. main()
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement