Users: Bring back ability to NOT set the last names

This commit is contained in:
veselcraft 2022-02-07 20:16:47 +03:00
parent 33df6ef170
commit 47093f40cc
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -751,9 +751,12 @@ class User extends RowModel
function setLast_Name(string $lastName): void
{
$lastName = mb_convert_case($lastName, MB_CASE_TITLE);
if(!preg_match('%^\p{Lu}\p{Mn}?(\p{L&}\p{Mn}?){1,16}(\-\g<1>+)?$%u', $lastName))
throw new InvalidUserNameException;
if(!empty($lastName))
{
$lastName = mb_convert_case($lastName, MB_CASE_TITLE);
if(!preg_match('%^\p{Lu}\p{Mn}?(\p{L&}\p{Mn}?){1,16}(\-\g<1>+)?$%u', $lastName))
throw new InvalidUserNameException;
}
$this->stateChanges("last_name", $lastName);
}