mirror of
https://github.com/kevachat/webapp.git
synced 2025-02-02 09:55:58 +00:00
add system usernames validation
This commit is contained in:
parent
ec8fe840ff
commit
a8cbfffce2
2
.env
2
.env
@ -71,7 +71,7 @@ APP_MODERATOR_REMOTE_IP=
|
||||
APP_ADD_USER_NAME_REGEX=/^[0-9A-z-]{2,16}$/ui
|
||||
|
||||
# User name reserved (case insensitive) separated with |
|
||||
APP_ADD_USER_NAME_BLACKLIST=KevaChat|admin|moderator|anon|test
|
||||
APP_ADD_USER_NAME_BLACKLIST=KevaChat|admin|moderator|test
|
||||
|
||||
# Delay before have ability to create new username again
|
||||
APP_ADD_USER_REMOTE_IP_DELAY=86400
|
||||
|
@ -235,6 +235,18 @@ class UserController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
// Validate system username values
|
||||
if (in_array(mb_strtolower($username), ['anon','anonymous']))
|
||||
{
|
||||
return $this->redirectToRoute(
|
||||
'user_add',
|
||||
[
|
||||
'username' => $request->get('username'),
|
||||
'error' => $translator->trans('Username reserved for anonymous users!')
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Validate meta NS
|
||||
if (str_starts_with($username, '_'))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user