made passwordless login work

This commit is contained in:
Izaya 2017-10-08 00:30:26 +11:00
parent 0e3d368896
commit 83a84ea117
2 changed files with 4 additions and 3 deletions

View File

@ -4,10 +4,10 @@ function login()
if #os.users() > 0 then
repeat
io.write(net.id.." login: ")
un = io.read()
un = io.read()
io.write("Password: ")
pw = io.read("*")
cc = os.su(un,pw)
pw = io.read("*")
cc = os.su(un,pw)
until cc
return true
end

View File

@ -156,6 +156,7 @@ do -- so local works
function os.verifyuser(username,pass)
if sha then
if ut[username] then
if not os.getuattr(username,"hpass") or not os.getuattr(username,"salt") then return true end
if sha.sha256(pass..ut[username].salt) == ut[username].hpass then
return true
end