Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local edit = false
- local functions = {
- "edit",
- "-^- Edit your password"
- }
- local function fRead()
- if fs.exists(".@Main@./Config.cfg") then
- fs.isLocked = false
- fRead1 = fs.open(".@Main@./Config.cfg", "r")
- fPass = fRead1.readLine()
- fRead1.close()
- fs.isLocked = true
- else
- print("Error..... opening_error")
- sleep(3)
- end
- end
- local function fNew()
- fs.isLocked = false
- fWrite1 = fs.open(".@Main@./Config.cfg", "w")
- fWrite1.writeLine(nPass2)
- fWrite1.writeLine("3.0")
- fWrite1.writeLine("0.0")
- fWrite1.close()
- fs.isLocked = true
- end
- function askTODO()
- term.clear()
- term.setCursorPos(1,1)
- print("Type edit to edit password... type other words to exit")
- print("\n"..functions[1].." - this function is avaible")
- print("\n"..functions[2])
- write("\n your input > ")
- input = read()
- if input == "edit" or input == "Edit" or input == "EDIT" then
- edit = true
- else
- edit = false
- end
- end
- askTODO()
- if edit then
- print("Do you want to edit your current password?")
- write(" Y or N > ")
- YN = read()
- if YN == "Y" or YN == "y" then
- print("Please type your current password: ")
- write("> ")
- cPass = read("#")
- if cPass == fPass then
- print("Please type new password: ")
- write("> ")
- nPass1 = read("@")
- print("Please confirm new password: ")
- write("> ")
- nPass2 = read("#")
- if nPass2 == nPass1 then
- fNew()
- term.clear()
- term.setCursorPos(1,1)
- print("Password set...")
- print(nPass2)
- sleep(5)
- os.reboot()
- else
- term.clear()
- term.setCursorPos(1,1)
- print("Your passwords does not match...")
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- print("your input, does not match to the current password!...")
- sleep(4)
- term.clear()
- term.setCursorPos(1,1)
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- fs.isLocked = true
Advertisement
Add Comment
Please, Sign In to add comment