Advertisement
CodeAlpha42

client_login.lua

Jul 10th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 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("Please enter your credentials in order to access your Cloud Storage.")
  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.  
  22. term.setCursorPos(password_x, password_y)
  23. password = read("*")
  24.  
  25. if ftp.auth(modem, config["network_port"], config["default_timeout"], username, password) then
  26.     os.run({},"user_space.lua", config, modem, username)
  27. else
  28.     gui.clear()
  29.     gui.title("Alpha Cloud - v"..config["version"])
  30.     gui.jumpLine()
  31.     gui.text("Invalid credentials. Please check your password and username, and then retry.")
  32.  
  33.     os.sleep(3)
  34.     os.reboot()
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement