Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2670997
D25841.1734097605.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25841.1734097605.diff
View Options
diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
--- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php
+++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
@@ -342,6 +342,10 @@
if (!strlen($value_realname) && $require_real_name) {
$e_realname = pht('Required');
$errors[] = pht('Real name is required.');
+ } else if ($value_realname &&
+ !PhabricatorUser::validateRealName($value_realname)) {
+ $e_realname = pht('Invalid');
+ $errors[] = PhabricatorUser::describeValidRealName();
} else {
$e_realname = null;
}
diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -26,6 +26,7 @@
const SESSION_TABLE = 'phabricator_session';
const NAMETOKEN_TABLE = 'user_nametoken';
const MAXIMUM_USERNAME_LENGTH = 64;
+ const MAXIMUM_REALNAME_LENGTH = 256;
protected $userName;
protected $realName;
@@ -550,6 +551,16 @@
return (bool)preg_match('/^[a-zA-Z0-9._-]*[a-zA-Z0-9_-]\z/', $username);
}
+ public static function describeValidRealName() {
+ return pht(
+ 'Real Name must have no more than %d characters.',
+ new PhutilNumber(self::MAXIMUM_REALNAME_LENGTH));
+ }
+
+ public static function validateRealName($realname) {
+ return strlen($realname) <= self::MAXIMUM_REALNAME_LENGTH;
+ }
+
public static function getDefaultProfileImageURI() {
return celerity_get_resource_uri('/rsrc/image/avatar.png');
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 13, 13:46 (20 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1008189
Default Alt Text
D25841.1734097605.diff (1 KB)
Attached To
Mode
D25841: Account registration: Restrict Real Name length
Attached
Detach File
Event Timeline
Log In to Comment