Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.

Commit d820a7a

Browse files
committed
Return the userid in get_auth
1 parent fb17749 commit d820a7a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

init.lua

+6-5
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ do
8787
end
8888

8989
local S = tables.auths.schema
90-
local get_auth_stmt = conn:prepare('SELECT ' .. S.password .. ',' .. S.privs .. ',' ..
91-
S.lastlogin .. ' FROM ' .. tables.auths.name .. ' WHERE ' .. S.username .. '=?')
90+
local get_auth_stmt = conn:prepare('SELECT ' .. S.userid .. ',' .. S.password .. ',' .. S.privs ..
91+
',' .. S.lastlogin .. ' FROM ' .. tables.auths.name .. ' WHERE ' .. S.username .. '=?')
9292
thismod.get_auth_stmt = get_auth_stmt
9393
local get_auth_params = get_auth_stmt:bind_params({S.username_type})
9494
thismod.get_auth_params = get_auth_params
95-
local get_auth_results = get_auth_stmt:bind_result({S.password_type, S.privs_type,
95+
local get_auth_results = get_auth_stmt:bind_result({S.userid_type, S.password_type, S.privs_type,
9696
S.lastlogin_type})
9797
thismod.get_auth_results = get_auth_results
9898

@@ -156,8 +156,8 @@ do
156156
minetest.log('warning', modname .. ": get_auth(" .. name .. "): multiples lines were" ..
157157
" returned")
158158
end
159-
local password, privs_str, lastlogin = get_auth_results:get(1), get_auth_results:get(2),
160-
get_auth_results:get(3)
159+
local userid, password, privs_str, lastlogin = get_auth_results:get(1),
160+
get_auth_results:get(2), get_auth_results:get(3), get_auth_results:get(4)
161161
local admin = (name == minetest.setting_get("name"))
162162
local privs
163163
if singleplayer or admin then
@@ -176,6 +176,7 @@ do
176176
privs = minetest.string_to_privs(privs_str)
177177
end
178178
return {
179+
userid = userid,
179180
password = password,
180181
privileges = privs,
181182
last_login = tonumber(lastlogin)

0 commit comments

Comments
 (0)