diff options
-rwxr-xr-x | fripost-adduser | 2 | ||||
-rwxr-xr-x | fripost-newalias | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/fripost-adduser b/fripost-adduser index 86da15d..28141da 100755 --- a/fripost-adduser +++ b/fripost-adduser @@ -99,7 +99,7 @@ my $msg = MIME::Lite->new( From => 'admin@fripost.org', To => $user->{username}, Subject => 'Välkommen till Fripost!', - Data => slurp('templ/new_user_mail.tt'), # TODO: actually use TT + Data => scalar slurp('templ/new_user_mail.tt'), # TODO: actually use TT ); $msg->send(); diff --git a/fripost-newalias b/fripost-newalias index fb50a0c..53dd3e4 100755 --- a/fripost-newalias +++ b/fripost-newalias @@ -21,6 +21,7 @@ use FindBin qw($Bin); use lib "$Bin/lib"; use Data::Dumper; +use Email::Valid; use Fripost::Password; use Fripost::Prompt; use Fripost::Schema; @@ -43,11 +44,10 @@ my $schema = Fripost::Schema->connect( $conf->{dbi_dsn}, $conf->{admuser}, $conf->{admpass}, {} #\%dbi_params ); +# Get information my $goto = shift @ARGV; my @addr = @ARGV; - $goto //= prompt_username("Alias goto address: "); - @addr || push @addr, prompt "Alias address: "; if ($conf->{pretend}) { @@ -61,6 +61,10 @@ for my $addr (@addr) { address => $addr, }); if (!$rs->count) { + unless (Email::Valid->address($addr)) { + say "WARN: skipping invalid address $addr"; + next; + } my $db_alias = $schema->resultset('Alias')->new({ address => $addr, goto => $goto, |