mirror of
https://github.com/MinetestForFun/irc_modpack.git
synced 2024-12-22 23:20:17 +01:00
[irc_commands] Remove retro compat' and make checkToken precise
This commit is contained in:
parent
07e6a4dc54
commit
c32607320f
@ -137,22 +137,12 @@ function checkToken(playerName, token, usernick)
|
||||
else
|
||||
minetest.log("action", usernick.."@IRC attempted to log in as "
|
||||
..playerName.." unsuccessfully using a token")
|
||||
return false, "Incorrect token or player does not exist."
|
||||
end
|
||||
end
|
||||
|
||||
function checkPassword(playerName, password, usernick)
|
||||
if minetest.auth_table[playerName] and
|
||||
minetest.auth_table[playerName].password ==
|
||||
minetest.get_password_hash(playerName, password) then
|
||||
minetest.log("action", "User "..usernick
|
||||
.." from IRC logs in as "..playerName)
|
||||
irc_users[usernick] = playerName
|
||||
return true, "You are now logged in as "..playerName
|
||||
if irc_tokens[playerName] then
|
||||
return false, "Invalid token for player " .. playerName .. "."
|
||||
else
|
||||
minetest.log("action", usernick.."@IRC attempted to log in as "
|
||||
..playerName.." unsuccessfully")
|
||||
return false, "Incorrect password or player does not exist."
|
||||
return false, "No token generated by that player."
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@ -179,22 +169,7 @@ irc:register_bot_command("login", {
|
||||
return false, "You need to be in the server's channel to login."
|
||||
end
|
||||
|
||||
local u, m = checkToken(playerName, password, user.nick)
|
||||
if not u then
|
||||
if minetest.auth_table and minetest.auth_table[playerName] and minetest.auth_table[playerName].password:sub(1,3) == "#1#" then -- First SRP mechanism
|
||||
if not irc_tokens[playerName] then
|
||||
return false, "No token available for your nickname. " ..
|
||||
"Please consider generating one with /gen_token"
|
||||
else
|
||||
return u, m
|
||||
end
|
||||
else
|
||||
-- The old mechanism
|
||||
return checkPassword(playerName, password, user.nick)
|
||||
end
|
||||
else
|
||||
return u, m
|
||||
end
|
||||
return checkToken(playerName, password, user.nick)
|
||||
end
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user