Revert builtin auth handler changes

master
Brandon 2017-02-25 12:36:41 -06:00
parent 90df6de663
commit 75a15c932b
1 changed files with 3 additions and 8 deletions

View File

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