Add setting to disable user registration
parent
8a8360b2ce
commit
758abec7b8
17
README.md
17
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.
|
||||
|
||||
|
|
15
init.lua
15
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)
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue