Commit af6cd886 by Phil Hagelberg

Handle login failure and login error differently.

parent 501f0cf6
Pipeline #7720182 failed with stage
in 1 minute 22 seconds
......@@ -10,8 +10,10 @@ if(not os_ok) then print("Couldn't load OS:", os) return end
local sessions = {}
local new_session = function(username, password)
if(not os.is_authorized(hostname, username, password)) then return false end
local session_id = string.format("%x", love.math.random(4294967296))
if(not os.is_authorized(hostname, username, password)) then
return output:push({op="status", out="Login failed."})
end
local session_id = string.format("%x", love.math.random(42949672))
local stdin = love.thread.newChannel()
sessions[session_id] = os.new_session(stdin, output, username, hostname)
sessions[session_id].stdin = stdin
......@@ -34,7 +36,7 @@ while true do
elseif(msg.op == "login") then
local handle = function() print(debug.traceback()) end
if(not xpcall(new_session, handle, msg.username, msg.password)) then
output:push({op="status", out="Login failed."})
output:push({op="status", out="Login error."})
end
elseif(msg.op == "stdin" or msg.ssrpc) then -- ssrpc for server-side RPC
local session = sessions[msg.session]
......
......@@ -81,7 +81,7 @@ local test_completion = function()
t.assert_equal("/home/guest $ bin/", second_completed)
end
if(love.getVersion and love.getVersion():match("^0.1")) then
if(love.getVersion and ({love.getVersion()})[2] > 9) then
return {test_loans=test_loans, test_completion=test_completion}
else
return {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment