Update sPhone.lua

This commit is contained in:
Ale32bit 2015-11-13 23:22:02 +01:00
parent fcfd446832
commit 2265ec075a

View file

@ -122,6 +122,13 @@ local function kernel()
f.close() f.close()
end end
if not fs.exists("/.sPhone/config/newPassword") and fs.exists("/.sPhone/.password") then
fs.move("/.sPhone/.password","/.sPhone/config/.password")
f = fs.open("/.sPhone/config/newPassword","w")
f.write("Ignore Me. I just check if the password is moved to the config folder")
f.close()
end
if not fs.exists("/.sPhone/autorun") then if not fs.exists("/.sPhone/autorun") then
fs.makeDir("/.sPhone/autorun") fs.makeDir("/.sPhone/autorun")
end end
@ -693,7 +700,7 @@ end
term.setTextColor(colors.black) term.setTextColor(colors.black)
local passwordLogin = read("*") local passwordLogin = read("*")
term.redirect(sPhone.mainTerm) term.redirect(sPhone.mainTerm)
local fpw = fs.open("/.sPhone/.password","r") local fpw = fs.open("/.sPhone/config/.password","r")
if sha256.sha256(passwordLogin) == fpw.readLine() then if sha256.sha256(passwordLogin) == fpw.readLine() then
sPhone.wrongPassword = false sPhone.wrongPassword = false
home() home()
@ -742,7 +749,7 @@ end
local password2 = read("*") local password2 = read("*")
term.redirect(sPhone.mainTerm) term.redirect(sPhone.mainTerm)
if password1 == password2 then if password1 == password2 then
local f = fs.open("/.sPhone/.password", "w") local f = fs.open("/.sPhone/config/.password", "w")
f.write(sha256.sha256(password1)) f.write(sha256.sha256(password1))
f.close() f.close()
term.setTextColor(colors.lime) term.setTextColor(colors.lime)