CodeAlpha42

client_register.lua

Jul 10th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. t_args = {...}
  2.  
  3. config = t_args[1]
  4. modem = t_args[2]
  5.  
  6. modem.open(config["network_port"])
  7.  
  8.  
  9.  
  10. gui.clear()
  11. gui.title("Alpha Cloud - v"..config["version"])
  12. gui.jumpLine()
  13. gui.text("In order to create an account, you need to choose a username and a password. Make sure your password is strong enough, so nobody can find it!")
  14. gui.jumpLine()
  15.  
  16. username_x, username_y = gui.field("Username")
  17. password_x, password_y = gui.field("Password")
  18.  
  19. term.setCursorPos(username_x, username_y)
  20. username = read()
  21. term.setCursorPos(password_x, password_y)
  22. password = read("*")
  23.  
  24. gui.clear()
  25. gui.title("Alpha Cloud - v"..config["version"])
  26. gui.jumpLine()
  27.  
  28. if ftp.register(modem,config["network_port"],config["default_timeout"],username,password) then
  29.     gui.text("Your account has been succesfuly created!")
  30. else
  31.     gui.text("An account with the same username already exists, please change your username!")
  32. end
  33.  
  34. os.sleep(3)
  35. os.reboot()
Add Comment
Please, Sign In to add comment