Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement