diff --git a/README.md b/README.md index abfd894..be839c2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,16 @@ Automatically create accounts in bulk, and export a report to .CSV or .HTML. Fro License: MIT -## Show the GUI +## Settings + +* `accountmgr.allow_user_register`: Default true. If enabled, users can create + an account. Setting this to false is desirable when you're using bulk account + creation and don't want users to be able to create their own accounts. + + +## Bulk Account Creation + +### Show the GUI Grant yourself the server privilege, and then run the chatcommand: @@ -12,7 +21,7 @@ Grant yourself the server privilege, and then run the chatcommand: /accounts -## Importing +### Importing You can import users from a .csv file by placing it in the world directory, selecting it in the "Import from CSV" list, and clicking import. @@ -30,7 +39,7 @@ Or you can also include privileges and notes: Notes are freeform text, and will appear in the account report -## Editing Users +### Editing Users When you click "Save" in the Create/Update section, it'll copy the fields into the user list. If the user exists, it'll be overridden. Otherwise, a new user @@ -44,7 +53,7 @@ click save. Clicking Delete will delete the user with the given name. -## Exporting +### Exporting Click "Create Accounts" to create/update the users and generate the reports. diff --git a/init.lua b/init.lua index f991f26..4ad362c 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("accountmgr") + local bulk_create_dialog = dofile(minetest.get_modpath("accountmgr") .. "/bulk_create.lua") minetest.register_chatcommand("accounts", { @@ -11,3 +13,16 @@ minetest.register_chatcommand("accounts", { return true end, }) + + +minetest.register_on_prejoinplayer(function(name, ip) + local allow_user_register = minetest.settings:get_bool("accountmgr.allow_user_register", true) + if allow_user_register then + return + end + + local handler = minetest.get_auth_handler() + if not handler.get_auth(name) then + return S("User not found, registration is closed on this server") + end +end) diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..3f2a8dc --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,4 @@ +# If enabled, users can create an account. Setting this to false is desirable +# when you're using bulk account creation and don't want users to be able to +# create their own accounts. +accountmgr.allow_user_register (Allow Users to Register) bool true