mirror of
https://github.com/kevachat/webapp.git
synced 2025-01-11 23:38:02 +00:00
use publication key regex as user name rule
This commit is contained in:
parent
a7e03d8018
commit
241cf3e302
3
.env
3
.env
@ -74,9 +74,6 @@ APP_SESSION_ONLINE_TIMEOUT=900
|
|||||||
# Moderators IP with extra permissions, separated with |
|
# Moderators IP with extra permissions, separated with |
|
||||||
APP_MODERATOR_REMOTE_IP=
|
APP_MODERATOR_REMOTE_IP=
|
||||||
|
|
||||||
# User name regex condition
|
|
||||||
APP_ADD_USER_NAME_REGEX=/^[0-9A-z-]{2,16}$/ui
|
|
||||||
|
|
||||||
# User name reserved (case insensitive) separated with |
|
# User name reserved (case insensitive) separated with |
|
||||||
APP_ADD_USER_NAME_BLACKLIST=KevaChat|admin|moderator|test
|
APP_ADD_USER_NAME_BLACKLIST=KevaChat|admin|moderator|test
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ parameters:
|
|||||||
app.kevacoin.mine.solo.url: '%env(APP_KEVACOIN_MINE_SOLO_URL)%'
|
app.kevacoin.mine.solo.url: '%env(APP_KEVACOIN_MINE_SOLO_URL)%'
|
||||||
app.session.default.timeout: '%env(APP_SESSION_DEFAULT_TIMEOUT)%'
|
app.session.default.timeout: '%env(APP_SESSION_DEFAULT_TIMEOUT)%'
|
||||||
app.session.online.timeout: '%env(APP_SESSION_ONLINE_TIMEOUT)%'
|
app.session.online.timeout: '%env(APP_SESSION_ONLINE_TIMEOUT)%'
|
||||||
app.add.user.name.regex: '%env(APP_ADD_USER_NAME_REGEX)%'
|
|
||||||
app.add.user.name.blacklist: '%env(APP_ADD_USER_NAME_BLACKLIST)%'
|
app.add.user.name.blacklist: '%env(APP_ADD_USER_NAME_BLACKLIST)%'
|
||||||
app.add.user.remote.ip.delay: '%env(APP_ADD_USER_REMOTE_IP_DELAY)%'
|
app.add.user.remote.ip.delay: '%env(APP_ADD_USER_REMOTE_IP_DELAY)%'
|
||||||
app.add.room.remote.ip.regex: '%env(APP_ADD_ROOM_REMOTE_IP_REGEX)%'
|
app.add.room.remote.ip.regex: '%env(APP_ADD_ROOM_REMOTE_IP_REGEX)%'
|
||||||
|
@ -91,7 +91,7 @@ class UserController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate username regex
|
// Validate username regex
|
||||||
if (!preg_match($this->getParameter('app.add.user.name.regex'), $user['key']))
|
if (!preg_match($this->getParameter('app.add.post.key.regex'), $user['key']))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -470,7 +470,7 @@ class UserController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate username regex
|
// Validate username regex
|
||||||
if (!preg_match($this->getParameter('app.add.user.name.regex'), $username))
|
if (!preg_match($this->getParameter('app.add.post.key.regex'), $username))
|
||||||
{
|
{
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'user_add',
|
'user_add',
|
||||||
@ -478,7 +478,7 @@ class UserController extends AbstractController
|
|||||||
'username' => $request->get('username'),
|
'username' => $request->get('username'),
|
||||||
'error' => sprintf(
|
'error' => sprintf(
|
||||||
$translator->trans('Username does not match node requirements: %s!'),
|
$translator->trans('Username does not match node requirements: %s!'),
|
||||||
$this->getParameter('app.add.user.name.regex')
|
$this->getParameter('app.add.post.key.regex')
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@ -798,7 +798,7 @@ class UserController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate username regex
|
// Validate username regex
|
||||||
if (!preg_match($this->getParameter('app.add.user.name.regex'), $username))
|
if (!preg_match($this->getParameter('app.add.post.key.regex'), $username))
|
||||||
{
|
{
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'user_login',
|
'user_login',
|
||||||
@ -806,7 +806,7 @@ class UserController extends AbstractController
|
|||||||
'username' => $request->get('username'),
|
'username' => $request->get('username'),
|
||||||
'error' => sprintf(
|
'error' => sprintf(
|
||||||
$translator->trans('Username does not match node requirements: %s!'),
|
$translator->trans('Username does not match node requirements: %s!'),
|
||||||
$this->getParameter('app.add.user.name.regex')
|
$this->getParameter('app.add.post.key.regex')
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user