From d019b4c7fed2f4a5586b5f83365b1e9f9121a343 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Tue, 12 Dec 2017 22:23:23 +0100
Subject: [PATCH] core: Add more Twig templates

---
 .../core/templates/logout-iframe-wrapper.twig    | 16 ++++++++++++++++
 modules/core/templates/no_cookie.twig            | 13 +++++++++++++
 modules/core/www/idp/logout-iframe.php           |  2 ++
 modules/core/www/no_cookie.php                   |  4 ++++
 4 files changed, 35 insertions(+)
 create mode 100644 modules/core/templates/logout-iframe-wrapper.twig
 create mode 100644 modules/core/templates/no_cookie.twig

diff --git a/modules/core/templates/logout-iframe-wrapper.twig b/modules/core/templates/logout-iframe-wrapper.twig
new file mode 100644
index 000000000..7c9e415d0
--- /dev/null
+++ b/modules/core/templates/logout-iframe-wrapper.twig
@@ -0,0 +1,16 @@
+
+{% set pagetitle = '{logout:progress}'|trans %}
+{% extends "base.twig" %}
+
+{% block content %}
+    {# pretty arbitrary height, but should have enough safety margins for most cases #}
+    {% set iframeHeight = (25 + (SPs|length * 4)) %}
+
+    <iframe style="width:100%; height: {{ iframeHeight }}em; border:0;" src="logout-iframe.php?type=embed&id={{ auth_state|escape('url') }}"></iframe>
+
+    {% for assocId, sp in SPs %}
+    {% if attribute(sp, 'core:Logout-IFrame:State') == 'inprogress' %}
+    <iframe style="width:0; height:0; border:0;" src="{{ attribute(sp, 'core:Logout-IFrame:URL')|escape('html') }}</iframe>
+    {% endif %}
+    {% endfor %}
+{% endblock %}
diff --git a/modules/core/templates/no_cookie.twig b/modules/core/templates/no_cookie.twig
new file mode 100644
index 000000000..7205318e2
--- /dev/null
+++ b/modules/core/templates/no_cookie.twig
@@ -0,0 +1,13 @@
+
+{% set pagetitle = '{core:no_cookie:header}'|trans %}
+{% extends "base.twig" %}
+
+{% block content %}
+    <h2>{{ header }}</h2>
+    <p>{{ description }}</p>
+    {% if retryURL is not null %}
+    <ul>
+        <li><a href="{{ retryURL|escape('html') }}" id="retry">{{ retry }}</a></li>
+    </ul>
+    {% endif %}
+{% endblock %}
diff --git a/modules/core/www/idp/logout-iframe.php b/modules/core/www/idp/logout-iframe.php
index caf00f11d..f5e8e4e6a 100644
--- a/modules/core/www/idp/logout-iframe.php
+++ b/modules/core/www/idp/logout-iframe.php
@@ -122,6 +122,8 @@ if ($type === 'nojs') {
 
 $t = new SimpleSAML_XHTML_Template($globalConfig, $template_id);
 $t->data['auth_state'] = $id;
+$t->data['header'] = $t->t('{logout:progress}');
+
 /**
  * @deprecated The "id" variable will be removed. Please use "auth_state" instead.
  */
diff --git a/modules/core/www/no_cookie.php b/modules/core/www/no_cookie.php
index 46e67a579..ec330500f 100644
--- a/modules/core/www/no_cookie.php
+++ b/modules/core/www/no_cookie.php
@@ -9,5 +9,9 @@ if (isset($_REQUEST['retryURL'])) {
 
 $globalConfig = SimpleSAML_Configuration::getInstance();
 $t = new SimpleSAML_XHTML_Template($globalConfig, 'core:no_cookie.tpl.php');
+
+$t->data['header'] = htmlspecialchars($t->t('{core:no_cookie:header}'));
+$t->data['description'] = htmlspecialchars($t->t('{core:no_cookie:description}'));
+$t->data['retry'] = htmlspecialchars($t->t('{core:no_cookie:retry}'));
 $t->data['retryURL'] = $retryURL;
 $t->show();
-- 
GitLab