Skip to content

Commit 13ec2fd

Browse files
committed
Do not enforce Twig on oldui
Conflicts: lib/IdP/ADFS.php
1 parent 3207f4f commit 13ec2fd

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

lib/IdP/ADFS.php

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -186,28 +186,30 @@ private static function signResponse($response, $key, $cert, $algo, $passphrase)
186186
private static function postResponse($url, $wresult, $wctx)
187187
{
188188
$config = \SimpleSAML\Configuration::getInstance();
189-
$newui = $config->getBoolean('usenewui', false);
190-
191-
// Remove this in SSP 2.0 when Twig has become the default
192-
if ($newui === false) {
193-
$config = \SimpleSAML\Configuration::loadFromArray(['usenewui' => true]);
194-
}
195-
196-
$t = new \SimpleSAML\XHTML\Template($config, 'adfs:postResponse.twig');
197-
$t->data['baseurlpath'] = \SimpleSAML\Module::getModuleURL('adfs');
198-
$t->data['url'] = $url;
199-
$t->data['wresult'] = $wresult;
200-
$t->data['wctx'] = $wctx;
201-
202-
// Remove the IF-part in SSP 2.0 when Twig has become the default
203-
if ($newui === false) {
204-
$twig = $t->getTwig();
205-
if (!isset($twig)) {
206-
throw new \Exception('Even though we explicitly configure that we want Twig, the Template class does not give us Twig. This is a bug.');
207-
}
208-
$result = $twig->render('adfs:postResponse.twig', $t->data);
209-
echo $result;
189+
$usenewui = $config->getBoolean('usenewui', false);
190+
if ($usenewui === false) {
191+
$wresult = htmlspecialchars($wresult);
192+
$wctx = htmlspecialchars($wctx);
193+
194+
$post = <<<MSG
195+
<body onload="document.forms[0].submit()">
196+
<form method="post" action="$url">
197+
<input type="hidden" name="wa" value="wsignin1.0">
198+
<input type="hidden" name="wresult" value="$wresult">
199+
<input type="hidden" name="wctx" value="$wctx">
200+
<noscript>
201+
<input type="submit" value="Continue">
202+
</noscript>
203+
</form>
204+
</body>
205+
MSG;
206+
echo $post;
210207
} else {
208+
$t = new \SimpleSAML\XHTML\Template($config, 'adfs:postResponse.twig');
209+
$t->data['baseurlpath'] = \SimpleSAML\Module::getModuleURL('adfs');
210+
$t->data['url'] = $url;
211+
$t->data['wresult'] = $wresult;
212+
$t->data['wctx'] = $wctx;
211213
$t->show();
212214
}
213215
}

0 commit comments

Comments
 (0)