diff options
author | Ian Duffe <joanofarctangent@gmail.com> | 2011-01-18 21:39:03 -0800 |
---|---|---|
committer | Ian Duffe <joanofarctangent@gmail.com> | 2011-01-18 21:39:03 -0800 |
commit | e7dfef272790cf79cce19e3459363e6ee95f73d5 (patch) | |
tree | c377400b0e5012de9889c2313dcf058fea7ab25b /pinyweb | |
parent | 0a34bdd06065f320bd23ef47aa03fecc44a59bfd (diff) | |
download | piny-code-e7dfef272790cf79cce19e3459363e6ee95f73d5.tar.gz piny-code-e7dfef272790cf79cce19e3459363e6ee95f73d5.zip |
Another newuser.cgi update
Diffstat (limited to 'pinyweb')
-rwxr-xr-x | pinyweb/cgi-bin/newuser.cgi | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pinyweb/cgi-bin/newuser.cgi b/pinyweb/cgi-bin/newuser.cgi index 0c9c2de..1950515 100755 --- a/pinyweb/cgi-bin/newuser.cgi +++ b/pinyweb/cgi-bin/newuser.cgi @@ -41,6 +41,11 @@ print header( -type => 'text/html' ), start_html( -title => 'piny-web: Create Us print start_form( -name => 'newuser_form' ); print start_p, "Enter a username and valid email address for the new user. Please remember that the username may only contain alphanumerics, underscores, periods, and dashes. The username may not begin with a dash, nor may it begin with the strings 'git-' or 'ikiwiki-'.", end_p; +print "<b>KEYS</b>", br; +for my $key (keys %{$ENV}) { + print $key . " - " . $ENV{$key}; + print br; +} # Actual input fields print start_table; print start_Tr, td( label( { -for => 'username' }, "Username: " ) ), td( { -style => 'text-align: right;' }, textfield('username') ), end_Tr; @@ -72,7 +77,7 @@ sub create_user { $salt .= "\$"; my $crypt = crypt( $password, $salt ); - my $ret = system("/usr/sbin/useradd", "-c", "$email", "-k", "/var/empty", "-g", "users", "-m", "-p", $crypt, "-s", "/usr/bin/pinyshell", $username); - if ($ret) { return $! . ' - ' . ($? >> 8); } #return 'An error occurred creating the user; most likely, that username is already taken.\n'; } + my $ret = system("/usr/sbin/piny-suid", $ENV{'REMOTE_USER'}, "/usr/sbin/useradd", "-c", "$email", "-k", "/var/empty", "-g", "users", "-m", "-p", $crypt, "-s", "/usr/bin/pinyshell", $username); + if ($ret) { return $ENV{'REMOTE_USER'} . ' An error occurred creating the user; most likely, that username is already taken.\n'; } else { return 'Your user has been created. Try logging in!\n'; } }; |