|
87 | 87 | end
|
88 | 88 |
|
89 | 89 | 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 .. '=?') |
92 | 92 | thismod.get_auth_stmt = get_auth_stmt
|
93 | 93 | local get_auth_params = get_auth_stmt:bind_params({S.username_type})
|
94 | 94 | 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, |
96 | 96 | S.lastlogin_type})
|
97 | 97 | thismod.get_auth_results = get_auth_results
|
98 | 98 |
|
|
156 | 156 | minetest.log('warning', modname .. ": get_auth(" .. name .. "): multiples lines were" ..
|
157 | 157 | " returned")
|
158 | 158 | 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) |
161 | 161 | local admin = (name == minetest.setting_get("name"))
|
162 | 162 | local privs
|
163 | 163 | if singleplayer or admin then
|
|
176 | 176 | privs = minetest.string_to_privs(privs_str)
|
177 | 177 | end
|
178 | 178 | return {
|
| 179 | + userid = userid, |
179 | 180 | password = password,
|
180 | 181 | privileges = privs,
|
181 | 182 | last_login = tonumber(lastlogin)
|
|
0 commit comments