From b78077ad4080c4c2ababac4a4bf9a9f54500e845 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Wed, 19 Jan 2011 23:58:26 -0800 Subject: Better error messages for invalid usernames. --- libpiny/lib/Piny/User.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libpiny/lib') diff --git a/libpiny/lib/Piny/User.pm b/libpiny/lib/Piny/User.pm index 20ef4f1..6267ecb 100644 --- a/libpiny/lib/Piny/User.pm +++ b/libpiny/lib/Piny/User.pm @@ -18,7 +18,7 @@ use Piny::Group; subtype 'Username' => as 'Str' => where { $_ =~ /^(?!(git|ikiwiki)-)[a-zA-Z][a-zA-Z0-9_.-]*$/ } - => message { 'That username is not in the correct format for a piny user.' } + => message { if ( /^((?:git|ikiwiki)-|[^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" } } ; # Attributes -- cgit v1.2.3