Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- old=os.pullEvent
- os.pullEvent=os.pullEventRaw
- os.loadAPI("walCrypt")
- function invalid(txt,st,col)
- term.setCursorPos(1,1)
- term.setTextColor(col)
- term.setBackgroundColor(colors.blue)
- sX,sY=term.getSize()
- for u=1,sX do
- write(" ")
- end
- term.setCursorPos(st,1)
- write(txt)
- sleep(3)
- term.setTextColor(colors.black)
- end
- function main()
- d=true
- while d do
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.blue)
- sX,sY=term.getSize()
- for i=1,sX*2 do
- write(" ")
- end
- term.setCursorPos(19,1)
- term.setTextColor(colors.black)
- print("Please login: ")
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos(15,9)
- term.setTextColor(colors.blue)
- write("Username: ")
- term.setBackgroundColor(colors.gray)
- write(" ")
- term.setCursorPos(15,11)
- term.setTextColor(colors.blue)
- term.setBackgroundColor(colors.lightGray)
- write("Password: ")
- term.setBackgroundColor(colors.gray)
- write(" ")
- term.setCursorPos(26,9)
- term.setTextColor(colors.cyan)
- inUser = read()
- term.setCursorPos(26,11)
- inPass = read("*")
- if fs.exists("loginSettings/users/"..inUser) then
- a = fs.open("loginSettings/users/"..inUser,"r")
- pass = a.readLine()
- a.close()
- if tonumber(pass) == walCrypt.walCrypter(inPass) then
- d=false
- else
- invalid("Invalid login",19,colors.red)
- end
- else
- invalid("Invalid login",19,colors.red)
- end
- end
- invalid("Valid login",20,colors.green)
- os.pullEvent = old
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- curUser=inUser
- us=fs.open("loginSettings/curUser","w")
- us.writeLine(curUser)
- us.flush()
- us.close()
- shell.run(".shell")
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement