summaryrefslogtreecommitdiff
path: root/pinyadmin/sbin/newuser
diff options
context:
space:
mode:
authorJulian Blake Kongslie <jblake@omgwallhack.org>2011-04-27 19:22:52 -0700
committerJulian Blake Kongslie <jblake@omgwallhack.org>2011-04-27 19:22:52 -0700
commit68b72fa62aadbda4e48a4f9075b332583c5b5338 (patch)
tree9bf516006d78fcdd8a18c67e6b6f9bb6d5a4ffa1 /pinyadmin/sbin/newuser
parent89f316c608452cfafd6b4364e380852f363720dd (diff)
downloadpiny-code-68b72fa62aadbda4e48a4f9075b332583c5b5338.tar.gz
piny-code-68b72fa62aadbda4e48a4f9075b332583c5b5338.zip
Notification emails for new users.
Diffstat (limited to 'pinyadmin/sbin/newuser')
-rwxr-xr-xpinyadmin/sbin/newuser18
1 files changed, 18 insertions, 0 deletions
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'