Update authentication API usage

This commit is contained in:
ShadowNinja 2016-06-01 12:17:21 -04:00
parent 7161160667
commit 99afcc794b
1 changed files with 4 additions and 2 deletions

View File

@ -58,11 +58,13 @@ irc:register_bot_command("login", {
if not inChannel then if not inChannel then
return false, "You need to be in the server's channel to log in." return false, "You need to be in the server's channel to log in."
end end
local auth = minetest.auth_table[playerName] local handler = minetest.get_auth_handler()
if auth and minetest.get_password_hash(playerName, password) == auth.password then local auth = handler.get_auth(playerName)
if auth and minetest.check_password_entry(playerName, auth.password, password) then
minetest.log("action", "User "..user.nick minetest.log("action", "User "..user.nick
.." from IRC logs in as "..playerName) .." from IRC logs in as "..playerName)
irc_users[user.nick] = playerName irc_users[user.nick] = playerName
handler.record_login(playerName)
return true, "You are now logged in as "..playerName return true, "You are now logged in as "..playerName
else else
minetest.log("action", user.nick.."@IRC attempted to log in as " minetest.log("action", user.nick.."@IRC attempted to log in as "