Revert builtin auth handler changes
parent
90df6de663
commit
75a15c932b
|
@ -48,7 +48,7 @@ local function read_auth_file()
|
||||||
error("Invalid line in auth.txt: "..dump(line))
|
error("Invalid line in auth.txt: "..dump(line))
|
||||||
end
|
end
|
||||||
local privileges = core.string_to_privs(privilege_string)
|
local privileges = core.string_to_privs(privilege_string)
|
||||||
newtable[string.lower(name)] = {password=password, privileges=privileges, last_login=last_login}
|
newtable[name] = {password=password, privileges=privileges, last_login=last_login}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
io.close(file)
|
io.close(file)
|
||||||
|
@ -88,7 +88,6 @@ core.builtin_auth_handler = {
|
||||||
-- always has an empty password, otherwise use default, which is
|
-- always has an empty password, otherwise use default, which is
|
||||||
-- usually empty too)
|
-- usually empty too)
|
||||||
local new_password_hash = ""
|
local new_password_hash = ""
|
||||||
name = string.lower(name)
|
|
||||||
-- If not in authentication table, return nil
|
-- If not in authentication table, return nil
|
||||||
if not core.auth_table[name] then
|
if not core.auth_table[name] then
|
||||||
return nil
|
return nil
|
||||||
|
@ -120,10 +119,9 @@ core.builtin_auth_handler = {
|
||||||
last_login = core.auth_table[name].last_login,
|
last_login = core.auth_table[name].last_login,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
create_auth = function(name, password)
|
create_auth = function(name, password)
|
||||||
assert(type(name) == "string")
|
assert(type(name) == "string")
|
||||||
assert(type(password) == "string")
|
assert(type(password) == "string")
|
||||||
name = string.lower(name)
|
|
||||||
core.log('info', "Built-in authentication handler adding player '"..name.."'")
|
core.log('info', "Built-in authentication handler adding player '"..name.."'")
|
||||||
core.auth_table[name] = {
|
core.auth_table[name] = {
|
||||||
password = password,
|
password = password,
|
||||||
|
@ -135,7 +133,6 @@ core.builtin_auth_handler = {
|
||||||
set_password = function(name, password)
|
set_password = function(name, password)
|
||||||
assert(type(name) == "string")
|
assert(type(name) == "string")
|
||||||
assert(type(password) == "string")
|
assert(type(password) == "string")
|
||||||
name = string.lower(name)
|
|
||||||
if not core.auth_table[name] then
|
if not core.auth_table[name] then
|
||||||
core.builtin_auth_handler.create_auth(name, password)
|
core.builtin_auth_handler.create_auth(name, password)
|
||||||
else
|
else
|
||||||
|
@ -148,7 +145,6 @@ core.builtin_auth_handler = {
|
||||||
set_privileges = function(name, privileges)
|
set_privileges = function(name, privileges)
|
||||||
assert(type(name) == "string")
|
assert(type(name) == "string")
|
||||||
assert(type(privileges) == "table")
|
assert(type(privileges) == "table")
|
||||||
name = string.lower(name)
|
|
||||||
if not core.auth_table[name] then
|
if not core.auth_table[name] then
|
||||||
core.builtin_auth_handler.create_auth(name,
|
core.builtin_auth_handler.create_auth(name,
|
||||||
core.get_password_hash(name,
|
core.get_password_hash(name,
|
||||||
|
@ -163,7 +159,6 @@ core.builtin_auth_handler = {
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
record_login = function(name)
|
record_login = function(name)
|
||||||
name = string.lower(name)
|
|
||||||
assert(type(name) == "string")
|
assert(type(name) == "string")
|
||||||
assert(core.auth_table[name]).last_login = os.time()
|
assert(core.auth_table[name]).last_login = os.time()
|
||||||
save_auth_file()
|
save_auth_file()
|
||||||
|
@ -219,4 +214,4 @@ core.register_on_prejoinplayer(function(name, ip)
|
||||||
"or use a different nickname.", name, k)
|
"or use a different nickname.", name, k)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
Loading…
Reference in New Issue