added nil check for player object, force depends on formspecs
* player object check for problematic joins on inpcomplete auth process * close fixed https://codeberg.org/minenux/minetest-mod-auth_rx/issues/2 * added missing depends formspecs (it work without in basics but, some commands needs) * we will later aded formspecs checks to made optional
This commit is contained in:
parent
cbd4f2d26c
commit
a1150b3e46
2
db.lua
2
db.lua
@ -365,7 +365,7 @@ function AuthDatabase( path, name )
|
||||
end
|
||||
|
||||
self.on_login_success = function ( username, ip )
|
||||
if data[ username ].oldlogin == -1 then
|
||||
if not data[ username ].oldlogin or data[ username ].oldlogin == -1 then
|
||||
data[ username ].oldlogin = journal.optime
|
||||
end
|
||||
users[ username ] = data[ username ].newlogin
|
||||
|
2
depends.txt
Normal file
2
depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
default
|
||||
formspecs
|
@ -1,3 +1 @@
|
||||
Auth Redux is a drop-in replacement for the builtin authentication handler of Minetest. It is designed from the ground up to be robust and secure enough for use on high-traffic Minetest servers, while also addressing a number of outstanding engine bugs.
|
||||
|
||||
For more information: https://forum.minetest.net/viewtopic.php?f=9&t=20393
|
||||
|
24
init.lua
24
init.lua
@ -75,15 +75,32 @@ minetest.register_on_prejoinplayer( function ( player_name, player_ip )
|
||||
end )
|
||||
|
||||
minetest.register_on_joinplayer( function ( player )
|
||||
local player_name = player:get_player_name( )
|
||||
local player_ip = minetest.get_player_information( player_name ).address -- this doesn't work in singleplayer!
|
||||
local player_name
|
||||
local player_oj
|
||||
local player_ip
|
||||
if player ~= nil then
|
||||
player_name = player:get_player_name( )
|
||||
player_oj = minetest.get_player_information( player_name )
|
||||
player_ip = player_oj.address -- this doesn't work in singleplayer!
|
||||
auth_db.on_login_success( player_name, player_ip )
|
||||
auth_db.on_session_opened( player_name )
|
||||
auth_watchdog.on_success( convert_ipv4( player_ip ) )
|
||||
minetest.log( "debug", "[auth_rx] in authentication database players success joined ".. player_name )
|
||||
else
|
||||
minetest.log( "error", "[auth_rx] incomplete auth process on player obj nil ip obj address" )
|
||||
end
|
||||
end )
|
||||
|
||||
minetest.register_on_leaveplayer( function ( player )
|
||||
auth_db.on_session_closed( player:get_player_name( ) )
|
||||
|
||||
local name
|
||||
if player ~= nil then
|
||||
name = player:get_player_name( )
|
||||
auth_db.on_session_closed( name )
|
||||
minetest.log( "debug", "[auth_rx] player "..name.." leaving" )
|
||||
else
|
||||
minetest.log( "error", "[auth_rx] incomplete player leaving without writing in dbx due nil object" )
|
||||
end
|
||||
end )
|
||||
|
||||
minetest.register_on_shutdown( function( )
|
||||
@ -144,3 +161,4 @@ auth_filter.is_enabled = true
|
||||
|
||||
__commands( { auth_db = auth_db, auth_filter = auth_filter } )
|
||||
|
||||
print("[auth_rx] mod authentication database loaded" )
|
||||
|
3
mod.conf
3
mod.conf
@ -2,3 +2,6 @@ name = auth_rx
|
||||
title = Auth Redux
|
||||
author = sorcerykid
|
||||
license = MIT
|
||||
depends = default, formspecs
|
||||
optional_depends =
|
||||
description = Auth Redux is a drop-in replacement for the builtin authentication handler of Minetest. It is designed from the ground up to be robust and secure enough for use on high-traffic Minetest servers, while also addressing a number of outstanding engine bugs.
|
||||
|
Loading…
x
Reference in New Issue
Block a user