From 72b56c7f038915a6139f1fc3b4a01296fe65f824 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:13:42 +0800 Subject: [PATCH] convert review template to Twig --- .../locales/en/LC_MESSAGES/material.po | 36 +++++ .../locales/es/LC_MESSAGES/material.po | 36 +++++ .../locales/fr/LC_MESSAGES/material.po | 36 +++++ .../locales/ko/LC_MESSAGES/material.po | 36 +++++ .../themes/material/profilereview/review.php | 128 ----------------- .../themes/material/profilereview/review.twig | 134 ++++++++++++++++++ modules/profilereview/public/review.php | 4 +- .../src/Auth/Process/ProfileReview.php | 2 +- 8 files changed, 281 insertions(+), 131 deletions(-) delete mode 100644 modules/material/themes/material/profilereview/review.php create mode 100644 modules/material/themes/material/profilereview/review.twig diff --git a/modules/material/locales/en/LC_MESSAGES/material.po b/modules/material/locales/en/LC_MESSAGES/material.po index eceba73b..97cca45a 100644 --- a/modules/material/locales/en/LC_MESSAGES/material.po +++ b/modules/material/locales/en/LC_MESSAGES/material.po @@ -257,6 +257,42 @@ msgstr "Enable now" msgid "{nag:button_add}" msgstr "Add one now" +msgid "{review:title}" +msgstr "Profile review" + +msgid "{review:header}" +msgstr "Profile review" + +msgid "{review:info}" +msgstr "Are these still correct?" + +msgid "{review:mfa_header}" +msgstr "2-Step Verification" + +msgid "{review:methods_header}" +msgstr "Password Recovery Methods" + +msgid "{review:remaining}" +msgstr "(%count% remaining)" + +msgid "{review:used}" +msgstr "last used: %when%" + +msgid "{review:used_never}" +msgstr "last used: Never" + +msgid "{review:verified}" +msgstr "Verified" + +msgid "{review:unverified}" +msgstr "Unverified" + +msgid "{review:button_update}" +msgstr "Some of these need updating" + +msgid "{review:button_continue}" +msgstr "These are still correct" + msgid "{selectidp-links:title}" msgstr "Choose an identity account" diff --git a/modules/material/locales/es/LC_MESSAGES/material.po b/modules/material/locales/es/LC_MESSAGES/material.po index e3cec5b9..63a8c244 100644 --- a/modules/material/locales/es/LC_MESSAGES/material.po +++ b/modules/material/locales/es/LC_MESSAGES/material.po @@ -257,6 +257,42 @@ msgstr "Habilite ahora" msgid "{nag:button_add}" msgstr "Agrega uno ahora" +msgid "{review:title}" +msgstr "Revisión del perfil" + +msgid "{review:header}" +msgstr "Revisión del perfil" + +msgid "{review:info}" +msgstr "¿Siguen siendo correctos?" + +msgid "{review:mfa_header}" +msgstr "Verificación en 2 pasos" + +msgid "{review:methods_header}" +msgstr "Métodos de recuperación de contraseña" + +msgid "{review:remaining}" +msgstr "(%count% restante)" + +msgid "{review:used}" +msgstr "último uso: %when%" + +msgid "{review:used_never}" +msgstr "último uso: nunca" + +msgid "{review:verified}" +msgstr "Verificado" + +msgid "{review:unverified}" +msgstr "Inconfirmado" + +msgid "{review:button_update}" +msgstr "Algunos de estos necesitan actualización" + +msgid "{review:button_continue}" +msgstr "Estos siguen siendo correctos" + msgid "{selectidp-links:title}" msgstr "Elige una cuenta de identidad" diff --git a/modules/material/locales/fr/LC_MESSAGES/material.po b/modules/material/locales/fr/LC_MESSAGES/material.po index 7dd52353..6979159f 100644 --- a/modules/material/locales/fr/LC_MESSAGES/material.po +++ b/modules/material/locales/fr/LC_MESSAGES/material.po @@ -257,6 +257,42 @@ msgstr "Activer maintenant" msgid "{nag:button_add}" msgstr "Ajouter un maintenant" +msgid "{review:title}" +msgstr "Examen du profil" + +msgid "{review:header}" +msgstr "Examen du profil" + +msgid "{review:info}" +msgstr "Sont-ils toujours corrects?" + +msgid "{review:mfa_header}" +msgstr "Vérification en 2 étapes" + +msgid "{review:methods_header}" +msgstr "Méthodes de récupération de mot de passe" + +msgid "{review:remaining}" +msgstr "(%count% restant)" + +msgid "{review:used}" +msgstr "dernière utilisation: %when%" + +msgid "{review:used_never}" +msgstr "Dernière utilisation: Jamais" + +msgid "{review:verified}" +msgstr "Vérifié" + +msgid "{review:unverified}" +msgstr "Non vérifié" + +msgid "{review:button_update}" +msgstr "Certains ont besoin d'être mis à jour" + +msgid "{review:button_continue}" +msgstr "Ceux-ci sont toujours corrects" + msgid "{selectidp-links:title}" msgstr "Choisissez un compte d'identité" diff --git a/modules/material/locales/ko/LC_MESSAGES/material.po b/modules/material/locales/ko/LC_MESSAGES/material.po index 414ce962..66a39faf 100644 --- a/modules/material/locales/ko/LC_MESSAGES/material.po +++ b/modules/material/locales/ko/LC_MESSAGES/material.po @@ -257,6 +257,42 @@ msgstr "지금 사용" msgid "{nag:button_add}" msgstr "지금 하나 추가" +msgid "{review:title}" +msgstr "프로필 검토" + +msgid "{review:header}" +msgstr "프로필 검토" + +msgid "{review:info}" +msgstr "여전히 맞습니까?" + +msgid "{review:mfa_header}" +msgstr "2 단계 인증" + +msgid "{review:methods_header}" +msgstr "비밀번호 복구 방법" + +msgid "{review:remaining}" +msgstr "(%count% 남음)" + +msgid "{review:used}" +msgstr "마지막 사용 시간 : %when%" + +msgid "{review:used_never}" +msgstr "마지막 사용 : Never" + +msgid "{review:verified}" +msgstr "검증 된" + +msgid "{review:unverified}" +msgstr "확인되지 않음" + +msgid "{review:button_update}" +msgstr "이들 중 일부는 업데이트해야합니다." + +msgid "{review:button_continue}" +msgstr "이들은 여전히 정확하다." + msgid "{selectidp-links:title}" msgstr "ID 계정 선택" diff --git a/modules/material/themes/material/profilereview/review.php b/modules/material/themes/material/profilereview/review.php deleted file mode 100644 index 039f4692..00000000 --- a/modules/material/themes/material/profilereview/review.php +++ /dev/null @@ -1,128 +0,0 @@ - - - - <?= $this->t('{material:review:title}') ?> - - - - - - -
-
-
- - t('{material:review:header}') ?> - -
-
- -
-
-

-

- t('{material:review:info}') ?> -

-

- -
- data['mfaOptions']) > 0): ?> -
-
-

- t('{material:review:mfa_header}') ?> -

-
- -
-
    - data['mfaOptions'] as $mfa): ?> -
  • - - - - - - - t('{material:review:remaining}', ['{count}' => (string) $mfa['data']['count']]) ?> - - - - - t('{material:review:used_never}') ?> - - t('{material:review:used}', ['{when}' => $mfa['last_used_utc']]) ?> - - - -
  • - -
-
-
- - - data['methodOptions']) > 0): ?> - -
-
-

- t('{material:review:methods_header}') ?> -

-
- -
-
    - data['methodOptions'] as $method): ?> -
  • - - - - - - - t('{material:review:'.($method['verified'] ? 'verified' : 'unverified').'}') ?> - - -
  • - -
-
-
- -
- -
- - t('{material:review:button_update}') ?> launch - - - -
-
-
- - -
- - diff --git a/modules/material/themes/material/profilereview/review.twig b/modules/material/themes/material/profilereview/review.twig new file mode 100644 index 00000000..f9588ce8 --- /dev/null +++ b/modules/material/themes/material/profilereview/review.twig @@ -0,0 +1,134 @@ + + + + {{ '{review:title}'|trans }} + + {% include 'header.twig' %} + + + + +
+
+
+ + {{ '{review:header}'|trans }} + +
+
+ +
+
+

+

+ {{ '{review:info}'|trans }} +

+

+ +
+ {% if mfaOptions|length > 0 %} +
+
+

+ {{ '{review:mfa_header}'|trans }} +

+
+ +
+
    + {% for mfa in mfaOptions %} +
  • + + + + {{ mfa.label }} + + {% if mfa.type == 'backupcode' %} + {{ '{review:remaining}'|trans({'%count%':mfa.data.count}) }} + {% endif %} + + + {% if mfa.last_used_utc is empty %} + {{ '{review:used_never}'|trans }} + {% else %} + {{ '{review:used}'|trans({'%when%':mfa.last_used_utc}) }} + {% endif %} + + +
  • + {% endfor %} +
+
+
+ {% endif %} + + {% if methodOptions|length > 0 %} +
+
+

+ {{ '{review:methods_header}'|trans }} +

+
+ +
+
    + {% for method in methodOptions %} +
  • + + + + {{ method.value }} + + + {% set key = '{review:' ~ (method.verified ? 'verified' : 'unverified') ~ '}' %} + {{ key|trans }} + + +
  • + {% endfor %} +
+
+
+ {% endif %} +
+ +
+ + {{ '{review:button_update}'|trans }} launch + + + +
+
+
+ + {% include 'footer.twig' %} +
+ + diff --git a/modules/profilereview/public/review.php b/modules/profilereview/public/review.php index aa0cae04..c8f8b3f7 100644 --- a/modules/profilereview/public/review.php +++ b/modules/profilereview/public/review.php @@ -34,11 +34,11 @@ $globalConfig = Configuration::getInstance(); -$t = new Template($globalConfig, 'profilereview:review.php'); +$t = new Template($globalConfig, 'profilereview:review'); $t->data['profileUrl'] = $state['profileUrl']; $t->data['methodOptions'] = $state['methodOptions']; $t->data['mfaOptions'] = $state['mfaOptions']; -$t->show(); +$t->send(); $logger->warning(json_encode([ 'module' => 'profilereview', diff --git a/modules/profilereview/src/Auth/Process/ProfileReview.php b/modules/profilereview/src/Auth/Process/ProfileReview.php index f9f6e578..a42aeb6a 100644 --- a/modules/profilereview/src/Auth/Process/ProfileReview.php +++ b/modules/profilereview/src/Auth/Process/ProfileReview.php @@ -286,7 +286,7 @@ protected function redirectToProfileReview(&$state, $employeeId, $mfaOptions, $m $state['profileUrl'] = $this->profileUrl; $state['mfaOptions'] = $mfaOptions; $state['methodOptions'] = $methodOptions; - $state['template'] = 'review.php'; + $state['template'] = 'review'; $stateId = State::saveState($state, self::STAGE_SENT_TO_NAG); $url = Module::getModuleURL('profilereview/nag.php');