Skip to content
Snippets Groups Projects
Commit c214c33b authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

don't pass logger, handler error from caller

parent 76504725
No related branches found
No related tags found
No related merge requests found
......@@ -112,11 +112,6 @@ sub mail_notice {
my (%args) = @_;
my $tt2_file = $args{template};
my $mail_data = $args{data};
my $logger = $args{logger};
$logger->tracef(
sprintf('(template=%s, to=%s)', $args{template}, $args{to})
);
open SENDMAIL,
"|/usr/sbin/sendmail -f $args{from} $args{to}";
......@@ -125,9 +120,9 @@ sub mail_notice {
FILTERS => { qencode => [ \&qencode, 0 ] },
INCLUDE_PATH => $args{templates_dir}
});
unless ($tt2->process($tt2_file, $mail_data, \*SENDMAIL)) {
$logger->errorf("Error TT2 : %s", $tt2->error());
}
$tt2->process($tt2_file, $mail_data, \*SENDMAIL)
or die $tt2->error();
close SENDMAIL;
}
......
......@@ -185,14 +185,16 @@ sub respond {
## Mail notification of admins about the error
if (@errors_admin) {
$self->{out}->{subject} = 'Error notification - web interface';
IdPAccountManager::Tools::mail_notice(
template => 'mail/notification_generic_error.tt2.eml',
templates_dir => $self->{configuration}->{templates_dir},
data => $self->{out},
logger => $self->{logger},
to => $self->{configuration}->{admin_email},
from => $self->{configuration}->{notice_from}
);
eval {
IdPAccountManager::Tools::mail_notice(
template => 'mail/notification_generic_error.tt2.eml',
templates_dir => $self->{configuration}->{templates_dir},
data => $self->{out},
to => $self->{configuration}->{admin_email},
from => $self->{configuration}->{notice_from}
);
};
$self->{logger}->errorf("Error TT2 : %s", $EVAL_ERROR) if $EVAL_ERROR;
}
}
......@@ -409,14 +411,16 @@ sub req_generate_token {
$self->{out}->{subtitle} = 'Generate an authentication token';
## Send the challenge email with the token
IdPAccountManager::Tools::mail_notice(
template => 'mail/send_authentication_token.tt2.eml',
templates_dir => $self->{configuration}->{templates_dir},
from => $self->{configuration}->{notice_from}
to => $self->{in}->{email_address},
data => $self->{out},
logger => $self->{logger}
);
eval {
IdPAccountManager::Tools::mail_notice(
template => 'mail/send_authentication_token.tt2.eml',
templates_dir => $self->{configuration}->{templates_dir},
from => $self->{configuration}->{notice_from}
to => $self->{in}->{email_address},
data => $self->{out},
);
};
$self->{logger}->errorf("Error TT2 : %s", $EVAL_ERROR) if $EVAL_ERROR;
$self->{logger}->infof(
"Token send to %s for sp_entityid=%s;token=%s",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment