Skip to content

Commit 9a54d04

Browse files
committed
Improved error checking in check_login_name_for_creation
1 parent 1ba09fa commit 9a54d04

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Bugzilla/User.pm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,13 @@ sub check_login_name_for_creation {
326326
my ($invocant, $name) = @_;
327327
$name = trim($name);
328328
$name || ThrowUserError('user_login_required');
329-
validate_email_syntax($name)
330-
|| ThrowUserError('illegal_email_address', {addr => $name});
329+
330+
# No whitespace
331+
$name !~ /\s/ || ThrowUserError('login_illegal_character');
332+
333+
# We set the max length to 127 to ensure logins aren't truncated when
334+
# inserted into the tokens.eventdata field.
335+
length($name) <= 127 or ThrowUserError('login_too_long');
331336

332337
# Check the name if it's a new user, or if we're changing the name.
333338
if (!ref($invocant) || $invocant->login ne $name) {

0 commit comments

Comments
 (0)