From db75ce911c66b38a70b16f50feeb5a3304e53343 Mon Sep 17 00:00:00 2001 From: "jrayhawk+piny.be@omgwallhack.org" Date: Mon, 27 Dec 2010 04:53:19 -0800 Subject: Make failures for newuser more explicit. --- pinyadmin/sbin/newuser | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'pinyadmin') diff --git a/pinyadmin/sbin/newuser b/pinyadmin/sbin/newuser index ac3a51f..f2dabc3 100755 --- a/pinyadmin/sbin/newuser +++ b/pinyadmin/sbin/newuser @@ -114,14 +114,12 @@ if ( scalar @ARGV == 3 and $ARGV[0] eq "--batch" ) { }; # All the correctness checks should be repeated here. There are multiple -# pathways to get to this point, but only a single path from here on down. We -# don't need friendly error messages; whatever UI got us to this point *should* -# have already caught these. -exit 3 if ( not defined $email or $email eq "" ); -exit 3 if ( not defined $username or $username eq "" ); -exit 3 if ( $username =~ /^(git|ikiwiki)-/ ); -exit 3 if ( $username !~ /^[a-zA-Z0-9_.][a-zA-Z0-9_.-]+$/ ); -exit 3 if ( not defined $password or $password eq "" ); +# pathways to get to this point, but only a single path from here on down. +if ( not defined $email or $email eq "" ) { print "Email address is undefined!\n"; exit 3; }; +if ( not defined $username or $username eq "" ) { print "Username is undefined!\n"; exit 3; }; +if ( $username =~ /^(git|ikiwiki)-/ ) { print "Username must not begin with git- or ikiwiki-!\n"; exit 3; }; +if ( $username !~ /^[a-zA-Z0-9_.][a-zA-Z0-9_.-]+$/ ) { print "Usernames must consist only of letters, digits, underscores, periods, and dashes, and not start with a dash. Usernames are case sensitive.\n" }; +if ( not defined $password or $password eq "" ) { print "Password is undefined!\n"; exit 3; }; # Here on down is the actual creation code. -- cgit v1.2.3