Anyways here's the code:
function changepass()
term.clear()
term.setCursorPos(1,1)
write("Username: ")
local usrName = read()
write("Old password: ")
local oldpass = read("*")
write("New password: ")
local newpass = read("*")
if not fs.exists("users/"..usrName) then
term.clear()
term.setCursorPos(1,1)
print("No such username!")
sleep(1)
term.clear()
acc()
elseif fs.exists("users/"..usrName) then
local fileData = {}
local file = fs.open("users/"..usrName,"a")
repeat
table.insert(fileData, line)
line = file.readLine()
until line == nil -- readLine()
file.close()
local oldpassFromFile = fileData[1]
if pass == oldpassFromFile then
file.clear()
file.writeLine(newpass)
file.close()
term.clear()
term.setCursorPos(1,1)
print("Changed!")
sleep(1)
term.clear()
acc()
else
term.clear()
term.setCursorPos(1,1)
print("Failure!")
sleep(1)
term.clear()
acc()
end
end
end











