Skip to content
Snippets Groups Projects
Commit 856eebd1 authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

Fix email template of oldui interface to actually include the data.

This makes it mirror how it used to work and how the twig templates
work. The solution is not pretty, but the longer term solution is to
just get rid of the oldui exception.

Also actually run the existing EMail unit tests. That might have
caught this.

Closes: #1269
parent 3deadfeb
No related branches found
No related tags found
No related merge requests found
...@@ -256,7 +256,7 @@ class EMail ...@@ -256,7 +256,7 @@ class EMail
$newui = $config->getBoolean('usenewui', false); $newui = $config->getBoolean('usenewui', false);
if ($newui === false) { if ($newui === false) {
return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" $result = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
...@@ -274,11 +274,17 @@ pre { ...@@ -274,11 +274,17 @@ pre {
</style> </style>
</head> </head>
<body> <body>
<h1>' . htmlspecialchars($this->mail->Subject) . '</h1>
<div class="container" style="background: #fafafa; border: 1px solid #eee; margin: 2em; padding: .6em;"> <div class="container" style="background: #fafafa; border: 1px solid #eee; margin: 2em; padding: .6em;">
' . $this->text . ' <blockquote>"' . htmlspecialchars($this->text) . '"</blockquote>
</div> </div>';
</body> foreach ($this->data as $name => $values) {
</html>'; $result .= '<h2>' . htmlspecialchars($name) . '</h2><ul>';
foreach ($values as $value) {
$result .= '<li><pre>' . htmlspecialchars($value) . '</pre></li>';
}
$result .= '</ul>';
}
} else { } else {
$t = new Template($config, $template); $t = new Template($config, $template);
$twig = $t->getTwig(); $twig = $t->getTwig();
...@@ -293,7 +299,7 @@ pre { ...@@ -293,7 +299,7 @@ pre {
'text' => $this->text, 'text' => $this->text,
'data' => $this->data 'data' => $this->data
]); ]);
return $result;
} }
return $result;
} }
} }
...@@ -11,7 +11,7 @@ use SimpleSAML\Utils\EMail; ...@@ -11,7 +11,7 @@ use SimpleSAML\Utils\EMail;
/** /**
* A base SSP test case that tests some simple e-mail related calls * A base SSP test case that tests some simple e-mail related calls
*/ */
class EMailTestCase extends ClearStateTestCase class EMailTest extends ClearStateTestCase
{ {
/** /**
* @return void * @return void
......
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