Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Startup File
- Written by TheShadow989
- ]]--
- os.pullEvent = os.pullEventRaw
- os.loadAPI("xos/api/sha256")
- local verNumber = "Alpha 1.24"
- local tries = 1
- rRead = fs.open("xos/.usertable", "r")
- users = textutils.unserialize(rRead.readAll())
- rRead.close()
- local x = term.getSize()
- local function cPrint(string)
- x, _ = term.getSize()
- _, y = term.getCursorPos()
- term.setCursorPos((x-#string)/2,y)
- textutils.slowPrint(string)
- end
- --if users[5] == nil and users[8] == nil and users[11] == nill then
- --shell.run("xos/.firsttime")
- --end
- term.clear()
- term.setCursorPos(1,19)
- term.write("xOS "..verNumber.." by TheShadow989")
- term.setCursorPos(1,2)
- cPrint("xOS "..verNumber)
- sleep(1)
- while true do
- if tries == 4 then
- term.setCursorPos(1,8)
- term.clearLine()
- term.setCursorPos(22,10)
- term.clearLine()
- write("LOCKED")
- sleep(120)
- tries = 1
- term.clearLine()
- end
- term.setCursorPos(17,8)
- term.clearLine()
- write("Username: ")
- term.setCursorPos(17,10)
- term.clearLine()
- write("Password: ")
- term.setCursorPos(27,8)
- user = read()
- term.setCursorPos(27,10)
- pass = read('*')
- pass = sha256.sha256(pass)
- for i=2, #users, 3 do
- if user == users[i] and pass == users[i + 2] then
- users[1] = ""..i..""
- access = true
- end
- end
- tries = tries + 1
- if access == true then
- break
- end
- if tries ~= 4 then
- term.setCursorPos(5,14)
- term.setTextColor( colors.red )
- write("Incorrect username and password combination.")
- term.setTextColor( colors.white )
- sleep(3)
- term.clearLine()
- end
- end
- term.setCursorPos(19,14)
- write("Logging in...")
- term.setCursorPos(16,15)
- write("[ ]")
- term.setCursorPos(17,15)
- write("###")
- sleep(0.5)
- term.setCursorPos(20,15)
- write("###")
- sleep(1)
- term.setCursorPos(23,15)
- write("#####")
- sleep(0.2)
- term.setCursorPos(28,15)
- write("##")
- sleep(1)
- term.setCursorPos(30,15)
- write("###")
- sleep(0.5)
- rWrite = fs.open("xos/.usertable", "w")
- rWrite.write(textutils.serialize(users))
- rWrite.close()
- shell.run(".menu")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement