From 47093f40cce655047e0aa5acdd2a4f482c54a3df Mon Sep 17 00:00:00 2001 From: veselcraft Date: Mon, 7 Feb 2022 20:16:47 +0300 Subject: [PATCH] Users: Bring back ability to NOT set the last names --- Web/Models/Entities/User.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index 36077375..1161cbb6 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -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); }