Commit 55aaed7a authored by Xavier Guimard's avatar Xavier Guimard

Fix UTF-8 problems in mail

Fixes: #1338
parent 3273e9db
......@@ -307,7 +307,7 @@ sub _register {
$body =~ s/\$expMailDate/$req->datas->{expMailDate}/g;
$body =~ s/\$expMailTime/$req->datas->{expMailTime}/g;
$body =~ s/\$url/$url/g;
$body =~ s/\$(\w+)/decode("utf8",$req->datas->{registerInfo}->{$1})/ge;
$body =~ s/\$(\w+)/$req->datas->{registerInfo}->{$1}/eg;
# Send mail
return PE_MAILERROR
......@@ -358,7 +358,7 @@ sub _register {
$body = $self->loadTemplate( 'mail_register_done', filter => $tr );
# Replace variables in body
$body =~ s/\$(\w+)/decode("utf8",$req->datas->{registerInfo}->{$1})/ge;
$body =~ s/\$(\w+)/$req->datas->{registerInfo}->{$1}/ge;
# Send mail
return PE_MAILERROR
......
......@@ -9,7 +9,7 @@ BEGIN {
};
}
my $maintests = 8;
my $maintests = 9;
my ( $res, $user, $pwd );
SKIP: {
......@@ -45,18 +45,20 @@ SKIP: {
$res = $client->_post(
'/register',
IO::String->new(
'firstname=foo&lastname=bar&mail=foobar%40badwolf.org'),
length => 52,
'firstname=fôo&lastname=bar&mail=foobar%40badwolf.org'),
length => 53,
accept => 'text/html'
),
'Ask to create account'
);
expectOK($res);
ok( mail() =~ m#a href="http://auth.example.com/register\?(.*?)"#,
my $mail = mail();
ok( $mail =~ m#a href="http://auth.example.com/register\?(.*?)"#,
'Found register token' );
$query = $1;
ok( $query =~ /register_token=/, 'Found register_token' );
ok( $mail =~ /fôo/, 'UTF-8 works' ) or explain( $mail, 'fôo' );
ok(
$res =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment