Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tUsers={
- --usernames,passwords --list of usernames and password
- {"abc","123"},
- {"abba","abc"},
- {"cba","dde"},
- }
- function clear() -- clears the screen
- term.setCursorPos(1,1)
- term.clear()
- end
- clear() -- clears the screen
- print("Username: ")
- print("Password: ")
- term.setCursorPos(10,1)
- local oldUse = read() --input username
- term.setCursorPos(10,2)
- local oldPas = read("*") -- input old password
- for i = 1,#tUsers do
- if oldUse == tUsers[i][1] and oldPas == tUsers[i][2] then -- compare username and password
- clear() -- clears the screen
- print("New password: ")
- term.setCursorPos(14,1)
- local newPass1 = read("*") --input new password #1
- clear() -- clears the screen
- print("New Password: ")
- print("Type your new password again")
- sleep(.2)
- term.setCursorPos(14,1)
- local newPass2 = read("*") -- input new password #2
- if newPass1 == newPass2 then--compares your new passwords
- tUsers[i][2] = newPass1 -- if true change your old password
- else
- clear() -- clears the screen
- print("Did you misspell your new password?")
- print("Pleas try again :)")
- sleep(1.5)
- end
- clear() -- clears the screen
- print("Username:",tUsers[i][1])
- print("New Pass:",tUsers[i][2])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement