Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fs = require("filesystem")
- local term = require("term")
- local comp = require("component")
- local pc = require("computer")
- local event = require("event")
- local text = require("text")
- local gpu = comp.gpu
- function Startup()
- gpu.setBackground(0xaaaaFF)
- gpu.setForeground(0x000000)
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- print(" ")
- S = 0
- DrawSignInWindow(S)
- end
- function DrawSignInWindow(Stage)
- -- draw Window
- term.setCursor(15,7)
- gpu.setBackground(0xbbbbbb)
- print(" ")
- gpu.setBackground(0x0000ff)
- term.setCursor(15,8)
- gpu.setBackground(0x0000FF)
- print(" ")
- term.setCursor(15,9)
- print(" ")
- term.setCursor(15,10)
- print(" ")
- term.setCursor(15,11)
- gpu.setBackground(0x0000ff)
- print(" ")
- term.setCursor(15,12)
- print(" ")
- term.setCursor(15,13)
- print(" ")
- term.setCursor(15,14)
- print(" ")
- term.setCursor(15,15)
- print(" ")
- term.setCursor(15,16)
- print(" ")
- term.setCursor(15,17)
- print(" ")
- gpu.setBackground(0x0000ff)
- if Stage == 0 then
- DrawPass()
- elseif Stage == 1 then
- Fail1()
- elseif Stage == 2 then
- Fail2()
- elseif Stage == 3 then
- Success1()
- end
- end
- function DrawPass()
- term.setCursor(15,9)
- gpu.setForeground(0xffffff)
- print("Please enter your password")
- term.setCursor(15,10)
- print("Leave it blank for no password")
- term.setCursor(15,11)
- gpu.setForeground(0xFFAA00)
- print("RE-TIP: Remember to hit enter when you done")
- term.setCursor(15,12)
- gpu.setForeground(0xffffff)
- print("After 'enter' you will be logged in if correct")
- gpu.setForeground(0x000000)
- term.setCursor(15,14)
- gpu.setBackground(0xffffff)
- print(" ")
- Password()
- end
- function Password()
- term.setCursor(15,14)
- pass = text.trim(term.read(nil, false, nil, "*"))
- local CheckForUser = fs.list("/PowOS/user/")
- User = CheckForUser()
- checkForPass = io.open("/PowOS/user/"..User, "r")
- checkForPass = checkForPass:read("*all")
- if checkForPass ~= nil and pass == checkForPass then
- Stagey = 3
- DrawSignInWindow(Stagey)
- elseif checkForPass == nil and pass == "" then
- Stagey = 3
- DrawSignInWindow(Stagey)
- else
- Stagey = 1
- DrawSignInWindow(Stagey)
- end
- end
- function Fail1()
- term.setCursor(15,9)
- gpu.setForeground(0xff0000)
- print("FAILED")
- term.setCursor(15,10)
- gpu.setForeground(0xffffff)
- print("Invalid password!")
- term.setCursor(15,11)
- gpu.setForeground(0xFFAA00)
- print("TIP: Lost your password? try reinstall the OS")
- term.setCursor(15,12)
- gpu.setForeground(0xffffff)
- term.setCursor(15,16)
- gpu.setBackground(0x0000AA)
- print("[RETRY]")
- term.setCursor(53,16)
- print("[SHUTDOWN]")
- Fail1_touch()
- end
- function Fail1_touch()
- local _,_,x,y = event.pull("touch")
- if x >= 53 and y == 16 and x <= 63 then
- term.setCursor(1,1)
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- term.clear()
- pc.shutdown(false)
- elseif x >= 15 and y == 16 and x <= 22 then
- Startup()
- else
- Fail1_touch()
- end
- end
- function Fail2()
- term.setCursor(15,9)
- gpu.setForeground(0xff0000)
- print("FAILED")
- term.setCursor(15,10)
- gpu.setForeground(0xffffff)
- print("Password isn't correct!")
- term.setCursor(15,11)
- gpu.setForeground(0xFFAA00)
- print("TIP: Lost your password? try reinstall the OS")
- term.setCursor(15,12)
- gpu.setForeground(0xffffff)
- term.setCursor(15,16)
- gpu.setBackground(0x0000AA)
- print("[RETRY]")
- term.setCursor(53,16)
- print("[SHUTDOWN]")
- print(checkforPass)
- Fail1_touch()
- end
- function Success1()
- term.setCursor(1,1)
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- term.clear()
- os.execute("/PowOS/system/Desktop.lua")
- end
- Startup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement