Герхард PICCORO Lenz McKAY cfb83aab12 added authentication mod for subnasa huge manage of users as first step
* using https://codeberg.org/minenux/minetest-mod-formspecs
* using https://codeberg.org/minenux/minetest-mod-auth_rx
* changes:
** provide a way to initialize files if there is not one
   currently doe snot touch the auth.txt file neither converted
** solves: close: https://codeberg.org/minenux/minetest-mod-auth_rx/issues/6
** solved: close: https://bitbucket.org/sorcerykid/auth_rx/issues/7
** init the files when are fresh install, still do not convert from auth.txt
** 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
2022-02-10 18:19:33 -04:00

67 lines
1.8 KiB
Lua

--------------------------------------------------------
-- Minetest :: Auth Redux Mod v2.4 (auth_rx)
--
-- See README.txt for licensing and release notes.
-- Copyright (c) 2017-2018, Leslie E. Krause
--------------------------------------------------------
minetest = { }
function string.split( str, sep, has_nil )
res = { }
for val in string.gmatch( str .. sep, "(.-)" .. sep ) do
if val ~= "" or has_nil then
table.insert( res, val )
end
end
return res
end
minetest.log = function ( act, str )
print( "[" .. act .. "]", str )
end
minetest.register_globalstep = function ( ) end
--------------------------------------------------------
dofile( "../db.lua" )
local name = "auth.db"
local path = "."
print( "******************************************************" )
print( "* This script will rollback the Auth Redux database. *" )
print( "* Do not proceed unless you know what you are doing! *" )
print( "* -------------------------------------------------- *" )
print( "* Usage Example: *" )
print( "* lua rollback.lua ~/.minetest/worlds/world/auth.db *" )
print( "******************************************************" )
if arg[ 1 ] and arg[ 1 ] ~= "auth.db" then
path = string.match( arg[ 1 ], "^(.*)/auth%.db$" )
if not path then
error( "Invalid arguments specified." )
end
end
print( "The following database will be modified:" )
print( " " .. path .. "/" .. name )
print( )
io.write( "Do you wish to continue (y/n)? " )
local opt = io.read( 1 )
if opt == "y" then
print( "Initiating rollback procedure..." )
local auth_db = AuthDatabase( path, name )
auth_db.rollback( )
os.rename( path .. "/" .. name .. "x", path .. "/~" .. name .. "x" )
if not io.open( path .. "/" .. name .. "x", "w+b" ) then
minetest.log( "error", "Cannot open " .. path .. "/~" .. name .. " for writing." )
end
end