Use regexp to replace values in email only for text body (#2495)
This commit is contained in:
parent
32d561e466
commit
6a6a41b007
|
@ -94,6 +94,11 @@ sub run {
|
||||||
|
|
||||||
# We use a specific text message, no html
|
# We use a specific text message, no html
|
||||||
$body = $self->conf->{mail2fBody};
|
$body = $self->conf->{mail2fBody};
|
||||||
|
|
||||||
|
# Replace variables in body
|
||||||
|
$body =~ s/\$code/$code/g;
|
||||||
|
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -109,12 +114,6 @@ sub run {
|
||||||
$html = 1;
|
$html = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
|
||||||
# FIXME: kept for compatibility with 2.0.0 mail templates
|
|
||||||
# in future versions this should only happen for plaintext emails
|
|
||||||
$body =~ s/\$code/$code/g;
|
|
||||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
|
||||||
|
|
||||||
# Send mail
|
# Send mail
|
||||||
unless ( $self->send_mail( $dest, $subject, $body, $html ) ) {
|
unless ( $self->send_mail( $dest, $subject, $body, $html ) ) {
|
||||||
$self->logger->error( 'Unable to send 2F code mail to ' . $dest );
|
$self->logger->error( 'Unable to send 2F code mail to ' . $dest );
|
||||||
|
|
|
@ -371,6 +371,13 @@ sub _certificateReset {
|
||||||
|
|
||||||
# We use a specific text message, no html
|
# We use a specific text message, no html
|
||||||
$body = $self->conf->{certificateResetByMailStep1Body};
|
$body = $self->conf->{certificateResetByMailStep1Body};
|
||||||
|
|
||||||
|
# Replace variables in body
|
||||||
|
$body =~ s/\$expMailDate/$req->data->{expMailDate}/ge;
|
||||||
|
$body =~ s/\$expMailTime/$req->data->{expMailTime}/ge;
|
||||||
|
$body =~ s/\$url/$url/g;
|
||||||
|
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -388,14 +395,6 @@ sub _certificateReset {
|
||||||
$html = 1;
|
$html = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
|
||||||
# FIXME: kept for compatibility with 2.0.0 mail templates
|
|
||||||
# in future versions this should only happen for plaintext emails
|
|
||||||
$body =~ s/\$expMailDate/$req->data->{expMailDate}/ge;
|
|
||||||
$body =~ s/\$expMailTime/$req->data->{expMailTime}/ge;
|
|
||||||
$body =~ s/\$url/$url/g;
|
|
||||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
|
||||||
|
|
||||||
# Send mail
|
# Send mail
|
||||||
unless (
|
unless (
|
||||||
$self->send_mail(
|
$self->send_mail(
|
||||||
|
@ -555,6 +554,10 @@ sub modifyCertificate {
|
||||||
|
|
||||||
# We use a specific text message, no html
|
# We use a specific text message, no html
|
||||||
$body = $self->conf->{certificateResetByMailStep2Body};
|
$body = $self->conf->{certificateResetByMailStep2Body};
|
||||||
|
|
||||||
|
# Replace variables in body
|
||||||
|
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -568,11 +571,6 @@ sub modifyCertificate {
|
||||||
$html = 1;
|
$html = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
|
||||||
# FIXME: kept for compatibility with 2.0.0 mail templates
|
|
||||||
# in future versions this should only happen for plaintext emails
|
|
||||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
|
||||||
|
|
||||||
# Send mail
|
# Send mail
|
||||||
return PE_MAILERROR
|
return PE_MAILERROR
|
||||||
unless $self->send_mail( $req->data->{mailAddress}, $subject, $body,
|
unless $self->send_mail( $req->data->{mailAddress}, $subject, $body,
|
||||||
|
|
|
@ -335,6 +335,13 @@ sub _reset {
|
||||||
|
|
||||||
# We use a specific text message, no html
|
# We use a specific text message, no html
|
||||||
$body = $self->conf->{mailConfirmBody};
|
$body = $self->conf->{mailConfirmBody};
|
||||||
|
|
||||||
|
# Replace variables in body
|
||||||
|
$body =~ s/\$expMailDate/$req->data->{expMailDate}/ge;
|
||||||
|
$body =~ s/\$expMailTime/$req->data->{expMailTime}/ge;
|
||||||
|
$body =~ s/\$url/$url/g;
|
||||||
|
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -352,14 +359,6 @@ sub _reset {
|
||||||
$html = 1;
|
$html = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
|
||||||
# FIXME: kept for compatibility with 2.0.0 mail templates
|
|
||||||
# in future versions this should only happen for plaintext emails
|
|
||||||
$body =~ s/\$expMailDate/$req->data->{expMailDate}/ge;
|
|
||||||
$body =~ s/\$expMailTime/$req->data->{expMailTime}/ge;
|
|
||||||
$body =~ s/\$url/$url/g;
|
|
||||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
|
||||||
|
|
||||||
$self->logger->info( "User "
|
$self->logger->info( "User "
|
||||||
. $req->data->{mailAddress}
|
. $req->data->{mailAddress}
|
||||||
. " is trying to reset his/her password" );
|
. " is trying to reset his/her password" );
|
||||||
|
@ -515,6 +514,11 @@ sub changePwd {
|
||||||
|
|
||||||
# We use a specific text message, no html
|
# We use a specific text message, no html
|
||||||
$body = $self->conf->{mailBody};
|
$body = $self->conf->{mailBody};
|
||||||
|
|
||||||
|
# Replace variables in body
|
||||||
|
$body =~ s/\$password/$password/g;
|
||||||
|
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -530,12 +534,6 @@ sub changePwd {
|
||||||
$html = 1;
|
$html = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
|
||||||
# FIXME: kept for compatibility with 2.0.0 mail templates
|
|
||||||
# in future versions this should only happen for plaintext emails
|
|
||||||
$body =~ s/\$password/$password/g;
|
|
||||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
|
||||||
|
|
||||||
# Send mail
|
# Send mail
|
||||||
return PE_MAILERROR
|
return PE_MAILERROR
|
||||||
unless $self->send_mail( $req->data->{mailAddress}, $subject, $body,
|
unless $self->send_mail( $req->data->{mailAddress}, $subject, $body,
|
||||||
|
|
|
@ -322,14 +322,6 @@ sub _register {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
# Replace variables in body
|
|
||||||
# FIXME: kept for compatibility with 2.0.0 mail templates
|
|
||||||
# in future versions this should only happen for plaintext emails
|
|
||||||
$body =~ s/\$expMailDate/$req->data->{expMailDate}/g;
|
|
||||||
$body =~ s/\$expMailTime/$req->data->{expMailTime}/g;
|
|
||||||
$body =~ s/\$url/$url/g;
|
|
||||||
$body =~ s/\$(\w+)/$req->data->{registerInfo}->{$1}/eg;
|
|
||||||
|
|
||||||
# Send mail
|
# Send mail
|
||||||
return PE_MAILERROR
|
return PE_MAILERROR
|
||||||
unless $self->send_mail( $req->data->{registerInfo}->{mail},
|
unless $self->send_mail( $req->data->{registerInfo}->{mail},
|
||||||
|
@ -397,12 +389,6 @@ sub _register {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
# Replace variables in body
|
|
||||||
# FIXME: kept for compatibility with 2.0.0 mail templates
|
|
||||||
# in future versions this should only happen for plaintext emails
|
|
||||||
$body =~ s/\$url/$url/g;
|
|
||||||
$body =~ s/\$(\w+)/$req->data->{registerInfo}->{$1}/ge;
|
|
||||||
|
|
||||||
# Send mail
|
# Send mail
|
||||||
return PE_MAILERROR
|
return PE_MAILERROR
|
||||||
unless $self->send_mail( $req->data->{registerInfo}->{mail},
|
unless $self->send_mail( $req->data->{registerInfo}->{mail},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user