Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- os.loadAPI("SHA256")
- local dashboard = function()
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- term.write("Menu")
- term.setCursorPos(46,1)
- term.write("Login")
- term.setCursorPos(1,2)
- term.write("=======================================")
- while true do
- if x > 45 and y < 3 then
- login()
- end
- end
- end
- local login = function()
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- term.write("Login")
- term.setCursorPos(46,1)
- term.write("Register")
- term.setCursorPos(1,2)
- term.write("======================================")
- term.setCursorPos(20,15)
- term.write("Enter username.")
- term.setCursorPos(20,20)
- term.write("Enter password")
- term.setCursorPos(10,17)
- user = read()
- term.setCursorPos(20,23)
- password = read("*")
- pass = SHA256(password)
- Account = {user,pass}
- while true do
- id , m = rednet.receive()
- if id == 482 then
- if m[1] == "Valid" then
- menu()
- else
- dashboard()
- end
- end
- end
- end
- local register = function()
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- term.write("Register")
- term.setCursorPos(46,1)
- term.write("Login")
- term.setCursorPos(20,15)
- term.write("Username")
- term.setCursorPos(20,20)
- term.write("Password")
- term.setCursorPos(20,25)
- term.write("Passsword")
- term.setCusorPos(20,17)
- user = read()
- term.setCursorPos(20,22)
- pass1 = read("*")
- term.setCursorPos(20,27)
- pass2 = read("*")
- if pass1 == pass2 then
- pass = SHA256.sha256(pass1)
- Add = {"#@$",user,pass}
- rednet.send(482,Add)
- else
- term.clear()
- term.setCursorPos(20,20)
- term.write("Passwords do not match.")
- sleep(2)
- end
- while true do
- id, m = rednet.receive()
- if id == 482 then
- term.clear()
- term.setCurorPos(1,1)
- term.write(m)
- sleep(2)
- login()
- else
- term.clear()
- term.setCursorPos(1,1)
- term.write("Cnnection Failed")
- sleep(2)
- menu()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement