From 4d19e0af572486ff0cd38b365dfc7411a8207837 Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Sun, 24 Apr 2011 13:28:25 -0700 Subject: Adding new <32 character limit to usernames --- libpiny/lib/Piny/User.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libpiny') diff --git a/libpiny/lib/Piny/User.pm b/libpiny/lib/Piny/User.pm index f742f87..90742e7 100644 --- a/libpiny/lib/Piny/User.pm +++ b/libpiny/lib/Piny/User.pm @@ -18,8 +18,8 @@ use Piny::Group; subtype 'Username' => as 'Str' - => where { $_ =~ /^(?!(git|iki)-)[a-zA-Z][a-zA-Z0-9_.-]*$/ } - => message { if ( /^((?:git|iki)-|[^a-zA-Z])/ ) { "Usernames are not allowed to begin with $1" } elsif ( /([^a-zA-Z0-9_.-])/ ) { "Usernames are not allowed to contain $1" } else { "Invalid username" } } + => where { $_ =~ /^(?!(git|iki)-)[a-zA-Z][a-zA-Z0-9_.-]{0,30}$/ } + => message { if ( /^((?:git|iki)-|[^a-zA-Z])/ ) { "Usernames are not allowed to begin with $1" } elsif ( /([^a-zA-Z0-9_.-])/ ) { "Usernames are not allowed to contain $1" } elsif ( /[a-zA-Z0-9_.-]{32,}/ ) { "Usernames are not allowed to be more than 31 bytes" } else { "Invalid username" } } ; # Attributes -- cgit v1.2.3