Update mail templates to no longer use string substitution (#2495)
This commit is contained in:
parent
d696853556
commit
297dc830af
|
@ -103,12 +103,15 @@ sub run {
|
||||||
'mail_2fcode',
|
'mail_2fcode',
|
||||||
filter => $tr,
|
filter => $tr,
|
||||||
params => {
|
params => {
|
||||||
|
code => $code,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
$html = 1;
|
$html = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
# 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/\$code/$code/g;
|
||||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||||
|
|
||||||
|
|
|
@ -379,12 +379,18 @@ sub _certificateReset {
|
||||||
$req,
|
$req,
|
||||||
'mail_certificateConfirm',
|
'mail_certificateConfirm',
|
||||||
filter => $tr,
|
filter => $tr,
|
||||||
params => {},
|
params => {
|
||||||
|
expMailDate => $req->data->{expMailDate},
|
||||||
|
expMailTime => $req->data->{expMailTime},
|
||||||
|
url => $url,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
$html = 1;
|
$html = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
# 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/\$expMailDate/$req->data->{expMailDate}/ge;
|
||||||
$body =~ s/\$expMailTime/$req->data->{expMailTime}/ge;
|
$body =~ s/\$expMailTime/$req->data->{expMailTime}/ge;
|
||||||
$body =~ s/\$url/$url/g;
|
$body =~ s/\$url/$url/g;
|
||||||
|
@ -563,6 +569,8 @@ sub modifyCertificate {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
# 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;
|
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||||
|
|
||||||
# Send mail
|
# Send mail
|
||||||
|
|
|
@ -343,12 +343,18 @@ sub _reset {
|
||||||
$req,
|
$req,
|
||||||
'mail_confirm',
|
'mail_confirm',
|
||||||
filter => $tr,
|
filter => $tr,
|
||||||
params => {},
|
params => {
|
||||||
|
expMailDate => $req->data->{expMailDate},
|
||||||
|
expMailTime => $req->data->{expMailTime},
|
||||||
|
url => $url,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
$html = 1;
|
$html = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
# 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/\$expMailDate/$req->data->{expMailDate}/ge;
|
||||||
$body =~ s/\$expMailTime/$req->data->{expMailTime}/ge;
|
$body =~ s/\$expMailTime/$req->data->{expMailTime}/ge;
|
||||||
$body =~ s/\$url/$url/g;
|
$body =~ s/\$url/$url/g;
|
||||||
|
@ -503,6 +509,8 @@ sub changePwd {
|
||||||
}
|
}
|
||||||
my $body;
|
my $body;
|
||||||
my $html;
|
my $html;
|
||||||
|
my $password = $req->data->{newpassword};
|
||||||
|
|
||||||
if ( $self->conf->{mailBody} ) {
|
if ( $self->conf->{mailBody} ) {
|
||||||
|
|
||||||
# We use a specific text message, no html
|
# We use a specific text message, no html
|
||||||
|
@ -515,13 +523,16 @@ sub changePwd {
|
||||||
$req,
|
$req,
|
||||||
'mail_password',
|
'mail_password',
|
||||||
filter => $tr,
|
filter => $tr,
|
||||||
params => {%tplPrms},
|
params => {
|
||||||
|
%tplPrms, password => $password,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
$html = 1;
|
$html = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace variables in body
|
# Replace variables in body
|
||||||
my $password = $req->data->{newpassword};
|
# 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/\$password/$password/g;
|
||||||
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
$body =~ s/\$(\w+)/$req->{sessionInfo}->{$1} || ''/ge;
|
||||||
|
|
||||||
|
|
|
@ -314,10 +314,17 @@ sub _register {
|
||||||
$req,
|
$req,
|
||||||
'mail_register_confirm',
|
'mail_register_confirm',
|
||||||
filter => $tr,
|
filter => $tr,
|
||||||
params => {},
|
params => {
|
||||||
|
expMailDate => $req->data->{expMailDate},
|
||||||
|
expMailTime => $req->data->{expMailTime},
|
||||||
|
url => $url,
|
||||||
|
%{ $req->data->{registerInfo} || {} },
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
# Replace variables in body
|
# 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/\$expMailDate/$req->data->{expMailDate}/g;
|
||||||
$body =~ s/\$expMailTime/$req->data->{expMailTime}/g;
|
$body =~ s/\$expMailTime/$req->data->{expMailTime}/g;
|
||||||
$body =~ s/\$url/$url/g;
|
$body =~ s/\$url/$url/g;
|
||||||
|
@ -368,14 +375,6 @@ sub _register {
|
||||||
my $body;
|
my $body;
|
||||||
my $html = 1;
|
my $html = 1;
|
||||||
|
|
||||||
# Use HTML template
|
|
||||||
$body = $self->loadMailTemplate(
|
|
||||||
$req,
|
|
||||||
'mail_register_done',
|
|
||||||
filter => $tr,
|
|
||||||
params => {},
|
|
||||||
);
|
|
||||||
|
|
||||||
# Build portal url
|
# Build portal url
|
||||||
my $url = $self->conf->{portal};
|
my $url = $self->conf->{portal};
|
||||||
$url =~ s#/*$##;
|
$url =~ s#/*$##;
|
||||||
|
@ -387,7 +386,20 @@ sub _register {
|
||||||
( $req_url ? ( url => $req_url ) : () ),
|
( $req_url ? ( url => $req_url ) : () ),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Use HTML template
|
||||||
|
$body = $self->loadMailTemplate(
|
||||||
|
$req,
|
||||||
|
'mail_register_done',
|
||||||
|
filter => $tr,
|
||||||
|
params => {
|
||||||
|
url => $url,
|
||||||
|
%{ $req->data->{registerInfo} || {} },
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
# Replace variables in body
|
# 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/\$url/$url/g;
|
||||||
$body =~ s/\$(\w+)/$req->data->{registerInfo}->{$1}/ge;
|
$body =~ s/\$(\w+)/$req->data->{registerInfo}->{$1}/ge;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<TMPL_INCLUDE NAME="mail_header.tpl">
|
<TMPL_INCLUDE NAME="mail_header.tpl">
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
<span trspan="hello">Hello</span> $cn,<br />
|
<span trspan="hello">Hello</span> <TMPL_VAR NAME="session_cn" ESCAPE=HTML>,<br />
|
||||||
<br />
|
<br />
|
||||||
<span trspan="yourLoginCodeIs">Your login code is</span>
|
<span trspan="yourLoginCodeIs">Your login code is</span>
|
||||||
<b>$code</b><br/>
|
<b><TMPL_VAR NAME="code" ESCAPE=HTML></b><br/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<TMPL_INCLUDE NAME="mail_footer.tpl">
|
<TMPL_INCLUDE NAME="mail_footer.tpl">
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<TMPL_INCLUDE NAME="mail_header.tpl">
|
<TMPL_INCLUDE NAME="mail_header.tpl">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span trspan="hello">Hello</span> $cn,<br />
|
<span trspan="hello">Hello</span> <TMPL_VAR NAME="session_cn" ESCAPE=HTML>,<br />
|
||||||
<br />
|
<br />
|
||||||
<span><img src="cid:arrow:../common/bullet_go.png" alt="go"/></span>
|
<span><img src="cid:arrow:../common/bullet_go.png" alt="go"/></span>
|
||||||
<a href="$url" style="text-decoration:none;color:orange;">
|
<a href="<TMPL_VAR NAME="url" ESCAPE=HTML>" style="text-decoration:none;color:orange;">
|
||||||
<span trspan="click2ResetCertificate">Click here to reset your certificate</span>
|
<span trspan="click2ResetCertificate">Click here to reset your certificate</span>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<TMPL_INCLUDE NAME="mail_header.tpl">
|
<TMPL_INCLUDE NAME="mail_header.tpl">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span trspan="hello">Hello</span> $cn,<br />
|
<span trspan="hello">Hello</span> <TMPL_VAR NAME="session_cn" ESCAPE=HTML>,<br />
|
||||||
<br />
|
<br />
|
||||||
<span trspan="resetCertificateOK">Your certificate has been successfully reset!</span>
|
<span trspan="resetCertificateOK">Your certificate has been successfully reset!</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<TMPL_INCLUDE NAME="mail_header.tpl">
|
<TMPL_INCLUDE NAME="mail_header.tpl">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span trspan="hello">Hello</span> $cn,<br />
|
<span trspan="hello">Hello</span> <TMPL_VAR NAME="session_cn" ESCAPE=HTML>,<br />
|
||||||
<br />
|
<br />
|
||||||
<span><img src="cid:arrow:../common/bullet_go.png" alt="go"/></span>
|
<span><img src="cid:arrow:../common/bullet_go.png" alt="go"/></span>
|
||||||
<a href="$url" style="text-decoration:none;color:orange;">
|
<a href="<TMPL_VAR NAME="url" ESCAPE=HTML>" style="text-decoration:none;color:orange;">
|
||||||
<span trspan="click2Reset">Click here to reset your password</span>
|
<span trspan="click2Reset">Click here to reset your password</span>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<p>
|
<p>
|
||||||
<span trspan="autoMail">This mail was sent automatically</span><br />
|
<span trspan="autoMail">This mail was sent automatically</span><br />
|
||||||
<span trspan="requestIssuedFromIP">The request was issued from IP</span>
|
<span trspan="requestIssuedFromIP">The request was issued from IP</span>
|
||||||
$ipAddr
|
<TMPL_VAR NAME="session_ipAddr" ESCAPE=HTML>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<TMPL_INCLUDE NAME="mail_header.tpl">
|
<TMPL_INCLUDE NAME="mail_header.tpl">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span trspan="hello">Hello</span> $cn,<br />
|
<span trspan="hello">Hello</span> <TMPL_VAR NAME="session_cn" ESCAPE=HTML>,<br />
|
||||||
<br />
|
<br />
|
||||||
<TMPL_IF NAME="RESET">
|
<TMPL_IF NAME="RESET">
|
||||||
<span trspan="newPwdIs">Your new password is</span>
|
<span trspan="newPwdIs">Your new password is</span>
|
||||||
<span><img src="cid:key:../common/key.png" alt="key"/></span>
|
<span><img src="cid:key:../common/key.png" alt="key"/></span>
|
||||||
<b>$password</b>
|
<b><TMPL_VAR NAME="password" ESCAPE=HTML></b>
|
||||||
<TMPL_ELSE>
|
<TMPL_ELSE>
|
||||||
<span trspan="pwdChanged">Your password has been successfully changed!</span>
|
<span trspan="pwdChanged">Your password has been successfully changed!</span>
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<TMPL_INCLUDE NAME="mail_header.tpl">
|
<TMPL_INCLUDE NAME="mail_header.tpl">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span trspan="hello">Hello</span> $firstname $lastname,<br />
|
<span trspan="hello">Hello</span> <TMPL_VAR NAME="firstname" ESCAPE=HTML> <TMPL_VAR NAME="lastname" ESCAPE=HTML>,<br />
|
||||||
<br />
|
<br />
|
||||||
<span><img src="cid:arrow:../common/bullet_go.png" alt="go"/></span>
|
<span><img src="cid:arrow:../common/bullet_go.png" alt="go"/></span>
|
||||||
<a href="$url" style="text-decoration:none;color:orange;">
|
<a href="<TMPL_VAR NAME="url" ESCAPE=HTML>" style="text-decoration:none;color:orange;">
|
||||||
<span trspan="click2Register">Click here to confirm your account registration</span>
|
<span trspan="click2Register">Click here to confirm your account registration</span>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<TMPL_INCLUDE NAME="mail_header.tpl">
|
<TMPL_INCLUDE NAME="mail_header.tpl">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span trspan="hello">Hello</span> $firstname $lastname,<br />
|
<span trspan="hello">Hello</span> <TMPL_VAR NAME="firstname" ESCAPE=HTML> <TMPL_VAR NAME="lastname" ESCAPE=HTML>,<br />
|
||||||
<br />
|
<br />
|
||||||
<span trspan="accountCreated">Your account was successfully created.</span>
|
<span trspan="accountCreated">Your account was successfully created.</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<span trspan="yourLoginIs">Your login is</span>
|
<span trspan="yourLoginIs">Your login is</span>
|
||||||
<span><img src="cid:key:../common/bullet_go.png" alt="go"/></span>
|
<span><img src="cid:key:../common/bullet_go.png" alt="go"/></span>
|
||||||
<b>$login</b>
|
<b><TMPL_VAR NAME="login" ESCAPE=HTML></b>
|
||||||
<br />
|
<br />
|
||||||
<span trspan="pwdIs">Your password is</span>
|
<span trspan="pwdIs">Your password is</span>
|
||||||
<span><img src="cid:key:../common/key.png" alt="key"/></span>
|
<span><img src="cid:key:../common/key.png" alt="key"/></span>
|
||||||
<b>$password</b>
|
<b><TMPL_VAR NAME="password" ESCAPE=HTML></b>
|
||||||
</p>
|
</p>
|
||||||
<p><a href="$url"><span trspan="goToPortal">Click here to access to portal</span></a></p>
|
<p><a href="<TMPL_VAR NAME="url" ESCAPE=HTML>"><span trspan="goToPortal">Click here to access to portal</span></a></p>
|
||||||
|
|
||||||
<TMPL_INCLUDE NAME="mail_footer.tpl">
|
<TMPL_INCLUDE NAME="mail_footer.tpl">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user