Crysys icon

Account Login

Crysys | PRO | 12/17/18 09:51:19 PM UTC | 0 ⭐ | 1120 👁️ | Never ⏰ | []
Lua |

890 B

|

None

|

0 👍

/

0 👎

while true do --Enter the loop
  local accounts = { --use a table to define the usernames and their passwords
    ["Alex"] = "password",
  }
 
  function tReset() --formatting function for the terminal screen reset
    term.clear()
    term.setCursorPos(1,1)
  end
 
  tReset()
 
  write("!!!Login Required!!!")
  term.setCursorPos(1,3)
  write("Enter username")
  write("> ")
  input_user = read() --read the user input in clear text
 
  write("Enter password")
  write("> ")
  input_pass = read("*") --read the user input using *'s to hide the entry
 
  if accounts[input_user] == input_pass then --check if the username/password matches the table
    sleep(1)
    tReset()
    shell.run("menu") --move to our menu application
    break --break from the loop in order to properly use the next program
  else
    tReset()
    write("Incorrect Username/Password")
  end
end --end the loop

Comments