diff --git a/app/Models/User.php b/app/Models/User.php index 690dd0e97b..57b42d45ae 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -198,7 +198,8 @@ protected static function booted(): void }); static::saving(function (self $user) { - $user->email = mb_strtolower($user->email); + $user->username = str($user->username)->lower()->toString(); + $user->email = str($user->email)->lower()->toString(); }); static::deleting(function (self $user) { diff --git a/app/Services/Users/UserCreationService.php b/app/Services/Users/UserCreationService.php index 1728a491f7..53efb4933a 100644 --- a/app/Services/Users/UserCreationService.php +++ b/app/Services/Users/UserCreationService.php @@ -49,12 +49,6 @@ public function handle(array $data): User $data['username'] = str($data['email'])->before('@')->toString() . Str::random(3); } - $data['username'] = str($data['username']) - ->replace(['.', '-'], '') - ->ascii() - ->substr(0, 64) - ->toString(); - /** @var User $user */ $user = User::query()->forceCreate(array_merge($data, [ 'uuid' => Uuid::uuid4()->toString(),