Page Menu
Home
1F616EMO Bugtracker
Search
Configure Global Search
Log In
Files
F155891
init.lua
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
init.lua
View Options
-- twi_mods/username_restrictions/init.lua
-- Ban some usernames
-- Copyright (C) 2024 1F616EMO
-- SPDX-License-Identifier: LGPL-2.1-or-later
local
banned_parts
=
{}
for
_
,
part
in
ipairs
({
"admin"
,
"moderator"
,
"nigger"
,
"fuck"
,
})
do
banned_parts
[
part
]
=
antispoof
.
normalize
(
part
)
end
local
auth
core
.
register_on_prejoinplayer
(
function
(
name
)
if
name
==
"singleplayer"
or
name
==
core
.
settings
:
get
(
"name"
)
then
return
end
auth
=
auth
or
core
.
get_auth_handler
()
if
not
auth
.
get_auth
(
name
)
then
if
string.find
(
name
,
"L+O+L+"
)
then
-- As unclear as possible yet give some useful message
return
"This username is banned."
end
local
normalized_name
=
antispoof
.
normalize
(
name
)
for
orig_part
,
norm_part
in
pairs
(
banned_parts
)
do
if
string.find
(
normalized_name
,
norm_part
)
then
return
string.format
(
"Invalid username %s: Username cannt conain
\"
%s
\"
"
,
name
,
orig_part
)
end
end
end
end
)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 25, 3:01 PM (6 d, 12 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
30/b6/cdc6630f041f6551f6ef264cec0c
Default Alt Text
init.lua (1 KB)
Attached To
Mode
rTWIMODS Survival Server Custom Modifications
Attached
Detach File
Event Timeline
Log In to Comment