From 68b72fa62aadbda4e48a4f9075b332583c5b5338 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Wed, 27 Apr 2011 19:22:52 -0700 Subject: Notification emails for new users. --- libpiny/lib/Piny/Config.pm | 3 +++ pinyadmin/sbin/newuser | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) 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 <