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)
write("Username: ")
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 y == 1 and x == w then
return
end
end
else
break
end
end
sPhone.user = newUsername
config.write("/.sPhone/config/sPhone","username",newUsername)
sPhone.winOk("Username","Changed")
@ -83,15 +84,16 @@ local function changePassword()
term.setCursorPos(1,1)
term.setTextColor(sPhone.theme["lock.inputText"])
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 y == 1 and x == w then
term.redirect(sPhone.mainTerm)
return
end
end
else
break
end
end
term.redirect(sPhone.mainTerm)
local fpw = config.read("/.sPhone/config/sPhone","password")
if sha256.sha256(password) ~= fpw then
@ -128,15 +130,17 @@ local function changePassword()
term.setCursorPos(1,1)
term.setTextColor(sPhone.theme["lock.inputText"])
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 y == h and (x >= 10 and x <= w) then
skipped = true
config.write("/.sPhone/config/sPhone","lockEnabled",false)
end
end
break
end
else
break
end
end
term.redirect(sPhone.mainTerm)
if not skipped then
term.setBackgroundColor(sPhone.theme["lock.background"])
@ -184,14 +188,17 @@ local function changeLabel()
term.setTextColor(sPhone.theme["text"])
term.setCursorPos(2,5)
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 y == 1 and x == w then
return
end
end
else
break
end
end
newLabel = newLabel:gsub("&", string.char(0xc2)..string.char(0xa7)) --yay colors
os.setComputerLabel(newLabel)
sPhone.winOk("Computer Label set")
@ -281,10 +288,27 @@ local function editTheme()
end
end
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)
while true do
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
fs.delete(saveTheme)
end