[COMPONENT][Group] Check nickname on register

This commit is contained in:
Diogo Peralta Cordeiro 2022-02-14 01:21:40 +00:00
parent 262b14a977
commit 090a087832
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0
2 changed files with 8 additions and 2 deletions

View File

@ -27,6 +27,7 @@ use App\Core\ActorLocalRoles;
use App\Core\Cache;
use App\Core\DB\DB;
use App\Core\Form;
use App\Util\Nickname;
use function App\Core\I18n\_m;
use App\Core\Log;
use App\Core\Router\Router;
@ -213,7 +214,12 @@ class Group extends FeedController
$create_form->handleRequest($request);
if ($create_form->isSubmitted() && $create_form->isValid()) {
$data = $create_form->getData();
$nickname = $data['group_nickname'];
$nickname = Nickname::normalize(
nickname: $data['group_nickname'],
check_already_used: true,
which: Nickname::CHECK_LOCAL_GROUP,
check_is_allowed: true
);
Log::info(
_m(

View File

@ -133,7 +133,7 @@ class Security extends Controller
$data['password'] = $form->get('password')->getData();
// Already used is checked below
$nickname = Nickname::normalize($data['nickname'], check_already_used: false, which: Nickname::CHECK_LOCAL_USER, check_is_allowed: false);
$nickname = Nickname::normalize($data['nickname'], check_already_used: false, which: Nickname::CHECK_LOCAL_USER, check_is_allowed: true);
try {
$found_user = DB::findOneBy('local_user', ['or' => ['nickname' => $nickname, 'outgoing_email' => $data['email']]]);