Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- paintutils.drawFilledBox(1,1,51,51,colors.blue)
- paintutils.drawFilledBox(13,5,39,14,colors.black)
- finnishedWaiting=false
- login=false
- correctInput=false
- verified=false
- hidden="*"
- newHidden=nil
- term.setTextColor(colors.white)
- term.setCursorPos(16,7)
- write("Username:")
- term.setCursorPos(16,9)
- write("Password:")
- term.setCursorPos(24,11)
- term.setTextColor(colors.green)
- write("LOGIN")
- term.setCursorPos(32,13)
- term.setTextColor(colors.gray)
- write("Sign In")
- term.setCursorPos(35,6)
- term.setTextColor(colors.red)
- write("hide")
- term.setCursorPos(16,12)
- write("reboot")
- term.setTextColor(colors.white)
- term.setCursorPos(13,5)
- write("###########################")
- term.setCursorPos(13,14)
- write("###########################")
- for i=6,13 do
- term.setCursorPos(13,i)
- write("#")
- end
- for i=6,13 do
- term.setCursorPos(39,i)
- write("#")
- end
- --DESIGN
- --Login-Screen
- while login==false do
- event,numb,x,y=os.pullEvent("mouse_click")
- term.setCursorPos(x,y)
- if y==7 then
- paintutils.drawFilledBox(26,7,38,7,colors.black)
- term.setCursorPos(26,7)
- name=read()
- elseif y==12 then
- os.reboot()
- elseif y==9 then
- paintutils.drawFilledBox(26,9,38,9,colors.black)
- term.setCursorPos(26,9)
- pass=read(hidden)
- elseif y==11 then
- login=true
- elseif y==6 then
- hidden=newHidden
- if hidden=="*" then
- newHiden=nil
- else
- newHidden="*"
- end
- elseif y==13 then
- --Register-Screen
- paintutils.drawFilledBox(14,6,38,13,colors.black)
- term.setBackgroundColor(colors.orange)
- term.setCursorPos(15,7)
- print("Username:")
- term.setCursorPos(15,9)
- print("Password:")
- term.setCursorPos(15,11)
- print("confirm PW:")
- term.setBackgroundColor(colors.black)
- term.setCursorPos(14,13)
- term.setTextColor(colors.green)
- print("COMPLETE")
- term.setCursorPos(33,13)
- term.setTextColor(colors.red)
- print("cancel")
- term.setTextColor(colors.white)
- --Design
- while verified==false do
- event,numb,x,y=os.pullEvent("mouse_click")
- term.setCursorPos(x,y)
- if y==7 then
- paintutils.drawFilledBox(26,7,38,7,colors.black)
- term.setCursorPos(26,7)
- newUser=read()
- elseif y==9 then
- paintutils.drawFilledBox(26,9,38,9,colors.black)
- term.setCursorPos(26,9)
- newPass=read()
- elseif y==11 then
- paintutils.drawFilledBox(26,11,38,11,colors.black)
- term.setCursorPos(26,11)
- newPassC=read()
- elseif y==13 and x>13 and x<20 then
- if newPass==newPassC then
- if fs.exists("maxintosh/logindata/"..newUser) then
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- term.setCursorPos(19,4)
- write("User exists")
- sleep(2)
- shell.run("maxintosh/login")
- error()
- else
- file=fs.open("maxintosh/logindata/"..newUser,"w")
- file.writeLine(newPass)
- file.close()
- verified=true
- fs.copy("maxintosh/master","maxintosh/"..newUser)
- shell.run("maxintosh/login")
- error()
- end
- elseif y==13 and x>24 and x<32 then
- verified=true
- shell.run("maxintosh/login")
- shell.run("clear")
- error()
- end
- end
- end
- end
- end
- if fs.exists("maxintosh/logindata/"..name) then
- file=fs.open("maxintosh/logindata/"..name,"r")
- readedPass=file.readLine()
- file.close()
- if readedPass==pass then
- found=true
- else
- found=false
- term.setCursorPos(19,4)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.red)
- write("wrong password")
- sleep(1)
- end
- else
- found=false
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- term.setCursorPos(19,4)
- write(" unknown user")
- sleep(1)
- end
- if found==true then
- paintutils.drawFilledBox(1,1,51,51,colors.green)
- sleep(1)
- shell.run("clear")
- currentUser=name
- shell.run("maxintosh/desktop")
- else
- sleep(2)
- shell.run("maxintosh/login")
- end
Add Comment
Please, Sign In to add comment