summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpiny/lib/Piny/Config.pm3
-rwxr-xr-xpinyadmin/sbin/newuser18
2 files changed, 21 insertions, 0 deletions
diff --git a/libpiny/lib/Piny/Config.pm b/libpiny/lib/Piny/Config.pm
index 535df33..a715024 100644
--- a/libpiny/lib/Piny/Config.pm
+++ b/libpiny/lib/Piny/Config.pm
@@ -208,6 +208,9 @@ sub tweakable {
# The tweakables
+# Global tweakables, which only make sense in the global config file.
+tweakable "piny_newuseremail" => "jrayhawk\@omgwallhack.org", 'Str';
+
# Repo-specific tweakables, in the repos' .git/config files.
tweakable "piny_ikiwikidestdir" => "/srv/www/piny.be/", 'PathDir';
tweakable "piny_ikiwikisrcdir" => "/srv/ikiwiki/", 'PathDir';
diff --git a/pinyadmin/sbin/newuser b/pinyadmin/sbin/newuser
index a6bcf4d..eeb5617 100755
--- a/pinyadmin/sbin/newuser
+++ b/pinyadmin/sbin/newuser
@@ -5,6 +5,7 @@ use warnings;
use Email::Valid::Loose qw( );
+use Piny::Config;
use Piny::User;
my ( $email, $username, $password );
@@ -125,6 +126,23 @@ if ( not defined $password or $password eq "" ) { print "Password is undefi
# Here on down is the actual creation code.
+my $config = Piny::Config->new( );
+my $dest = $config->piny_newuseremail;
+
+unless( open( MAIL, "|/usr/lib/sendmail -t" ) ) {
+ die "Couldn't execute sendmail: $!\n";
+};
+print MAIL <<END;
+To: $dest
+Subject: Creating piny account $username
+Content-type: text/plain; charset=us-ascii
+
+A new piny account ``$username'' has been created.
+
+Email: $email
+END
+close( MAIL );
+
my @saltchars =
( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'