This commit is contained in:
Ale32bit 2016-11-10 18:21:32 +01:00 committed by GitHub
parent 10868b8abd
commit 3c59514c27

View file

@ -37,14 +37,15 @@ local function changeUsername()
term.setCursorPos(2,5) term.setCursorPos(2,5)
write("Username: ") write("Username: ")
while true do while true do
newUsername,mouse,x,y = sPhone.read(nil,nil,nil,true) newUsername,mouse,x,y = sPhone.read(nil,nil,nil,true,newUsername)
if mouse then if mouse then
if y == 1 and x == w then if y == 1 and x == w then
return return
end end
end else
break break
end end
end
sPhone.user = newUsername sPhone.user = newUsername
config.write("/.sPhone/config/sPhone","username",newUsername) config.write("/.sPhone/config/sPhone","username",newUsername)
sPhone.winOk("Username","Changed") sPhone.winOk("Username","Changed")
@ -83,15 +84,16 @@ local function changePassword()
term.setCursorPos(1,1) term.setCursorPos(1,1)
term.setTextColor(sPhone.theme["lock.inputText"]) term.setTextColor(sPhone.theme["lock.inputText"])
while true do while true do
password,mouse,x,y = sPhone.read("*",nil,nil,true) password,mouse,x,y = sPhone.read("*",nil,nil,true,password)
if mouse then if mouse then
if y == 1 and x == w then if y == 1 and x == w then
term.redirect(sPhone.mainTerm) term.redirect(sPhone.mainTerm)
return return
end end
end else
break break
end end
end
term.redirect(sPhone.mainTerm) term.redirect(sPhone.mainTerm)
local fpw = config.read("/.sPhone/config/sPhone","password") local fpw = config.read("/.sPhone/config/sPhone","password")
if sha256.sha256(password) ~= fpw then if sha256.sha256(password) ~= fpw then
@ -128,15 +130,17 @@ local function changePassword()
term.setCursorPos(1,1) term.setCursorPos(1,1)
term.setTextColor(sPhone.theme["lock.inputText"]) term.setTextColor(sPhone.theme["lock.inputText"])
while true do while true do
pwChange,mouse,x,y = sPhone.read("*",nil,nil,true) pwChange,mouse,x,y = sPhone.read("*",nil,nil,true,pwChange)
if mouse then if mouse then
if y == h and (x >= 10 and x <= w) then if y == h and (x >= 10 and x <= w) then
skipped = true skipped = true
config.write("/.sPhone/config/sPhone","lockEnabled",false) config.write("/.sPhone/config/sPhone","lockEnabled",false)
end
end
break break
end end
else
break
end
end
term.redirect(sPhone.mainTerm) term.redirect(sPhone.mainTerm)
if not skipped then if not skipped then
term.setBackgroundColor(sPhone.theme["lock.background"]) term.setBackgroundColor(sPhone.theme["lock.background"])
@ -184,14 +188,17 @@ local function changeLabel()
term.setTextColor(sPhone.theme["text"]) term.setTextColor(sPhone.theme["text"])
term.setCursorPos(2,5) term.setCursorPos(2,5)
while true do while true do
newLabel,mouse,x,y = sPhone.read(nil,nil,nil,true) term.setCursorPos(2,5)
term.clearLine()
newLabel,mouse,x,y = sPhone.read(nil,nil,nil,true,newLabel)
if mouse then if mouse then
if y == 1 and x == w then if y == 1 and x == w then
return return
end end
end else
break break
end end
end
newLabel = newLabel:gsub("&", string.char(0xc2)..string.char(0xa7)) --yay colors newLabel = newLabel:gsub("&", string.char(0xc2)..string.char(0xa7)) --yay colors
os.setComputerLabel(newLabel) os.setComputerLabel(newLabel)
sPhone.winOk("Computer Label set") sPhone.winOk("Computer Label set")
@ -281,10 +288,27 @@ local function editTheme()
end end
end end
elseif id == 9 then elseif id == 9 then
sPhone.header() local saveTheme
sPhone.header(sPhone.user)
term.setCursorPos(w,1)
term.setBackgroundColor(sPhone.theme["header"])
term.setTextColor(sPhone.theme["headerText"])
write("X")
term.setBackgroundColor(sPhone.theme["backgroundColor"])
term.setTextColor(sPhone.theme["text"])
visum.align("center", "Save Theme",false,3) visum.align("center", "Save Theme",false,3)
while true do
term.setCursorPos(2,5) term.setCursorPos(2,5)
local saveTheme = read() term.clearLine()
saveTheme,mouse,x,y = sPhone.read(nil,nil,nil,true,saveTheme)
if mouse then
if y == 1 and x == w then
return
end
else
break
end
end
if fs.exists(saveTheme) then if fs.exists(saveTheme) then
fs.delete(saveTheme) fs.delete(saveTheme)
end end