Advertisement
DOGGYWOOF

Set dogdroid lockscreen PIN

Mar 14th, 2024 (edited)
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. local function savePIN(pin)
  2. local file = fs.open("/disk/security/PIN.config", "w")
  3. file.write(pin)
  4. file.close()
  5. end
  6.  
  7. local function confirmPIN(pin)
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. print("Confirm PIN:")
  11. local confirm = read("*")
  12. return pin == confirm
  13. end
  14.  
  15. local function startDevice()
  16. term.clear()
  17. term.setCursorPos(1,1)
  18. print("Starting Device...")
  19. os.sleep(5)
  20. shell.run("/disk/os/lock.lua")
  21. end
  22.  
  23. -- Main program
  24. term.clear()
  25. term.setCursorPos(1,1)
  26. print("Enter new PIN:")
  27. local newPIN = read("*")
  28. if confirmPIN(newPIN) then
  29. savePIN(newPIN)
  30. startDevice()
  31. else
  32. print("PINs do not match. Aborting.")
  33. end
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement