mirror of
https://github.com/pelican-dev/panel.git
synced 2026-05-04 18:00:48 +03:00
Move username sanitization to model and make it less strict (#2150)
This commit is contained in:
@@ -198,7 +198,8 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
||||
});
|
||||
|
||||
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) {
|
||||
|
||||
@@ -49,12 +49,6 @@ class UserCreationService
|
||||
$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(),
|
||||
|
||||
Reference in New Issue
Block a user