summaryrefslogtreecommitdiff
path: root/libpiny/lib/Piny
diff options
context:
space:
mode:
authorJulian Blake Kongslie <jblake@omgwallhack.org>2011-01-19 23:58:26 -0800
committerJulian Blake Kongslie <jblake@omgwallhack.org>2011-01-19 23:58:26 -0800
commitb78077ad4080c4c2ababac4a4bf9a9f54500e845 (patch)
tree3624c1bea77c62da6a752e829c1412f6955d39e3 /libpiny/lib/Piny
parenta7614855dec85cbcb1853472f859db3a7242b3fa (diff)
downloadpiny-code-b78077ad4080c4c2ababac4a4bf9a9f54500e845.tar.gz
piny-code-b78077ad4080c4c2ababac4a4bf9a9f54500e845.zip
Better error messages for invalid usernames.
Diffstat (limited to 'libpiny/lib/Piny')
-rw-r--r--libpiny/lib/Piny/User.pm2
1 files changed, 1 insertions, 1 deletions
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