summaryrefslogtreecommitdiff
path: root/pinyadmin/sbin/newuser
diff options
context:
space:
mode:
authorjrayhawk+piny.be@omgwallhack.org <jrayhawk@dev.piny.svcs.cs.pdx.edu>2010-12-27 04:53:19 -0800
committerjrayhawk+piny.be@omgwallhack.org <jrayhawk@dev.piny.svcs.cs.pdx.edu>2010-12-27 04:53:19 -0800
commitdb75ce911c66b38a70b16f50feeb5a3304e53343 (patch)
treedff42fb82e4ff2c899131a12db3d7418d43d677a /pinyadmin/sbin/newuser
parent048f2894cc92fe7c6c2f2dabdb8c52d31f4f14d3 (diff)
downloadpiny-code-db75ce911c66b38a70b16f50feeb5a3304e53343.tar.gz
piny-code-db75ce911c66b38a70b16f50feeb5a3304e53343.zip
Make failures for newuser more explicit.
Diffstat (limited to 'pinyadmin/sbin/newuser')
-rwxr-xr-xpinyadmin/sbin/newuser14
1 files changed, 6 insertions, 8 deletions
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.