From a510a67f241f39907494fc2706a41e0a4852fe07 Mon Sep 17 00:00:00 2001 From: Thijs Kinkhorst <thijs@kinkhorst.com> Date: Wed, 6 Dec 2017 14:26:33 +0000 Subject: [PATCH] Twigification authX509 done. --- .../authX509/lib/Auth/Source/X509userCert.php | 5 +++- .../locales/da/LC_MESSAGES/authX509.po | 6 ++--- .../locales/el/LC_MESSAGES/authX509.po | 6 ++--- .../locales/en/LC_MESSAGES/authX509.po | 8 +++--- .../locales/es/LC_MESSAGES/authX509.po | 8 +++--- .../locales/nb/LC_MESSAGES/authX509.po | 6 ++--- .../locales/nl/LC_MESSAGES/authX509.po | 8 +++--- modules/authX509/templates/X509error.twig | 19 ++++++++++++++ modules/authX509/templates/X509warning.twig | 26 +++++++++++++++++++ 9 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 modules/authX509/templates/X509error.twig create mode 100644 modules/authX509/templates/X509warning.twig diff --git a/modules/authX509/lib/Auth/Source/X509userCert.php b/modules/authX509/lib/Auth/Source/X509userCert.php index e92f0c387..6e00188c7 100644 --- a/modules/authX509/lib/Auth/Source/X509userCert.php +++ b/modules/authX509/lib/Auth/Source/X509userCert.php @@ -69,10 +69,13 @@ class sspmod_authX509_Auth_Source_X509userCert extends SimpleSAML_Auth_Source public function authFailed(&$state) { $config = SimpleSAML_Configuration::getInstance(); + $errorcodes = SimpleSAML\Error\ErrorCodes::getAllErrorCodeMessages(); $t = new SimpleSAML_XHTML_Template($config, 'authX509:X509error.php'); + $t->data['loginurl'] = SimpleSAML\Utils\HTTP::getSelfURL(); $t->data['errorcode'] = $state['authX509.error']; - + $t->data['errortitle'] = $errorcodes['title'][$state['authX509.error']]; + $t->data['errordescr'] = $errorcodes['descr'][$state['authX509.error']]; $t->show(); exit(); } diff --git a/modules/authX509/locales/da/LC_MESSAGES/authX509.po b/modules/authX509/locales/da/LC_MESSAGES/authX509.po index 6e89789b1..ac4d02a7b 100644 --- a/modules/authX509/locales/da/LC_MESSAGES/authX509.po +++ b/modules/authX509/locales/da/LC_MESSAGES/authX509.po @@ -40,14 +40,14 @@ msgid "Please renew your certificate in time." msgstr "Forny venligst dit certifikat i tide." #, python-format -msgid "Your certificate will expire in %days% days." -msgstr "Dit certifikat udløber om %days% dage." +msgid "Your certificate will expire in %daysleft% days." +msgstr "Dit certifikat udløber om %daysleft% dage." msgid "X509 certificate authentication" msgstr "X509 certifikat authentifikation" #, python-format -msgid "Please <a href='%renewurl%'>renew</a> your certificate in time." +msgid "Please <a href='%renewurl%'>renew your certificate</a> in time." msgstr "<a href='%renewurl%'>Forny</a>, venligst dit certifikat før det udløber." msgid "Proceed" diff --git a/modules/authX509/locales/el/LC_MESSAGES/authX509.po b/modules/authX509/locales/el/LC_MESSAGES/authX509.po index 26cf3a027..1c11e6014 100644 --- a/modules/authX509/locales/el/LC_MESSAGES/authX509.po +++ b/modules/authX509/locales/el/LC_MESSAGES/authX509.po @@ -42,14 +42,14 @@ msgid "Please renew your certificate in time." msgstr "ΠαĎακαλείĎτε να Ď€ĎοχωĎήĎετε Ďε ανανÎωĎη του πιĎτοποιητικού Ďας ÎγκαιĎα." #, python-format -msgid "Your certificate will expire in %days% days." -msgstr "Η ÎąĎχύς του πιĎτοποιητικού Ďας θα λήξει Ďε %days%." +msgid "Your certificate will expire in %daysleft% days." +msgstr "Η ÎąĎχύς του πιĎτοποιητικού Ďας θα λήξει Ďε %daysleft%." msgid "X509 certificate authentication" msgstr "ΤαυτοποίηĎη ÎĽÎĎω πιĎτοποιητικού X.509" #, python-format -msgid "Please <a href='%renewurl%'>renew</a> your certificate in time." +msgid "Please <a href='%renewurl%'>renew your certificate</a> in time." msgstr "" "ΠαĎακαλείĎτε να Ď€ĎοχωĎήĎετε Ďε <a href=â€%renewurl%’>ανανÎωĎη</a> του " "πιĎτοποιητικού Ďας ÎγκαιĎα." diff --git a/modules/authX509/locales/en/LC_MESSAGES/authX509.po b/modules/authX509/locales/en/LC_MESSAGES/authX509.po index 6457d3edf..5f67704c1 100644 --- a/modules/authX509/locales/en/LC_MESSAGES/authX509.po +++ b/modules/authX509/locales/en/LC_MESSAGES/authX509.po @@ -40,15 +40,15 @@ msgid "Please renew your certificate in time." msgstr "Please renew your certificate in time." #, python-format -msgid "Your certificate will expire in %days% days." -msgstr "Your certificate will expire in %days% days." +msgid "Your certificate will expire in %daysleft% days." +msgstr "Your certificate will expire in %daysleft% days." msgid "X509 certificate authentication" msgstr "X509 certificate authentication" #, python-format -msgid "Please <a href='%renewurl%'>renew</a> your certificate in time." -msgstr "Please <a href='%renewurl%'>renew</a> your certificate in time." +msgid "Please <a href='%renewurl%'>renew your certificate</a> in time." +msgstr "Please <a href='%renewurl%'>renew your certificate</a> in time." msgid "Proceed" msgstr "Proceed" diff --git a/modules/authX509/locales/es/LC_MESSAGES/authX509.po b/modules/authX509/locales/es/LC_MESSAGES/authX509.po index 7256e926b..a398bade2 100644 --- a/modules/authX509/locales/es/LC_MESSAGES/authX509.po +++ b/modules/authX509/locales/es/LC_MESSAGES/authX509.po @@ -42,15 +42,15 @@ msgid "Please renew your certificate in time." msgstr "Por favor, renueve su certificado a tiempo." #, python-format -msgid "Your certificate will expire in %days% days." -msgstr "Su certificado caduca en %days% dĂas." +msgid "Your certificate will expire in %daysleft% days." +msgstr "Su certificado caduca en %daysleft% dĂas." msgid "X509 certificate authentication" msgstr "AutenticaciĂłn mediante certificado X509" #, python-format -msgid "Please <a href='%renewurl%'>renew</a> your certificate in time." -msgstr "Por favor, <a href=â€%renewurl%’>renueve</a> su certificado a tiempo." +msgid "Please <a href='%renewurl%'>renew your certificate</a> in time." +msgstr "Por favor, <a href=â€%renewurl%’>renueve su certificado</a> a tiempo." msgid "Proceed" msgstr "Continuar" diff --git a/modules/authX509/locales/nb/LC_MESSAGES/authX509.po b/modules/authX509/locales/nb/LC_MESSAGES/authX509.po index 1a74b995c..e6c708808 100644 --- a/modules/authX509/locales/nb/LC_MESSAGES/authX509.po +++ b/modules/authX509/locales/nb/LC_MESSAGES/authX509.po @@ -42,14 +42,14 @@ msgid "Please renew your certificate in time." msgstr "Vennligst forny sertifikatet ditt før det utløper." #, python-format -msgid "Your certificate will expire in %days% days." -msgstr "Sertifikatet ditt vil utløpe om %days% dager." +msgid "Your certificate will expire in %daysleft% days." +msgstr "Sertifikatet ditt vil utløpe om %daysleft% dager." msgid "X509 certificate authentication" msgstr "X509 sertifikatautentisering" #, python-format -msgid "Please <a href='%renewurl%'>renew</a> your certificate in time." +msgid "Please <a href='%renewurl%'>renew your certificate</a> in time." msgstr "" "Vennligst <a href=â€%renewurl%’>forny</a> sertifikatet ditt før det " "utløper." diff --git a/modules/authX509/locales/nl/LC_MESSAGES/authX509.po b/modules/authX509/locales/nl/LC_MESSAGES/authX509.po index 5e341db07..b7f5d3d96 100644 --- a/modules/authX509/locales/nl/LC_MESSAGES/authX509.po +++ b/modules/authX509/locales/nl/LC_MESSAGES/authX509.po @@ -42,15 +42,15 @@ msgid "Please renew your certificate in time." msgstr "Vervang tijdig je certificaat." #, python-format -msgid "Your certificate will expire in %days% days." -msgstr "Je certificaat verloopt over %days% dagen." +msgid "Your certificate will expire in %daysleft% days." +msgstr "Je certificaat verloopt over %daysleft% dagen." msgid "X509 certificate authentication" msgstr "Authenticatie via X509-certificaat" #, python-format -msgid "Please <a href='%renewurl%'>renew</a> your certificate in time." -msgstr "<a href='%renewurl%'>Vervang</a> tijdig je certificaat." +msgid "Please <a href=\"%renewurl%\">renew your certificate</a> in time." +msgstr "<a href=\"%renewurl%\">Vervang tijdig je certificaat</a>." msgid "Proceed" msgstr "Verder" diff --git a/modules/authX509/templates/X509error.twig b/modules/authX509/templates/X509error.twig new file mode 100644 index 000000000..c350ea53f --- /dev/null +++ b/modules/authX509/templates/X509error.twig @@ -0,0 +1,19 @@ +{% set pagetitle = 'X509 certificate authentication'|trans %} +{% extends "base.twig" %} +{% block content %} + +{% if errorcode -%} +<h2>{% trans 'Error' %}</h2> + <h3>{% trans errortitle %}</h3> + <p>{% trans errordescr %}</p> +{% endif -%} + +<h2>{% trans 'X509 certificate authentication' %}</h2> + +<p>{% trans 'X509 certificate authentication is required to access this service.' %}</p> + +<a href="{{ loginurl }}"> +{% trans 'Login' %} +</a> + +{% endblock %} diff --git a/modules/authX509/templates/X509warning.twig b/modules/authX509/templates/X509warning.twig new file mode 100644 index 000000000..59a65f64f --- /dev/null +++ b/modules/authX509/templates/X509warning.twig @@ -0,0 +1,26 @@ +{% set autofocus = 'proceedbutton' %} + +{% extends "base.twig" %} + +{% block content %} + +<h2>{% trans 'Your certificate is about to expire.' %}</h2> +<form action="{{ target | escape }}"> + + {% for name, value in data -%} + <input type="hidden" name="{{ name }}" value="{{ value }}" /> + {%- endfor %} + + <p>{% trans %}Your certificate will expire in {{ daysleft }} days.{% endtrans %}</p> + + {% if renewurl -%} + <p>{% trans %}Please <a href="{{ renewurl }}">renew your certificate</a> in time.{% endtrans %}</p> + {% else -%} + <p>{% trans 'Please renew your certificate in time.' %}</p> + {% endif -%} + + <p><input type="submit" name="proceed" id="proceedbutton" value="{% trans 'Proceed' %}" /></p> + +</form> + +{% endblock %} -- GitLab