From f98d444414927d5783c2339309a105912b932593 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:34:33 -0600 Subject: [PATCH 1/2] add space after colon in Twig maps --- modules/material/themes/material/mfa/low-on-backup-codes.twig | 2 +- modules/material/themes/material/mfa/new-backup-codes.twig | 2 +- modules/material/themes/material/mfa/send-manager-mfa.twig | 2 +- modules/material/themes/material/profilereview/review.twig | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/material/themes/material/mfa/low-on-backup-codes.twig b/modules/material/themes/material/mfa/low-on-backup-codes.twig index a5e84d5..dcaff9d 100644 --- a/modules/material/themes/material/mfa/low-on-backup-codes.twig +++ b/modules/material/themes/material/mfa/low-on-backup-codes.twig @@ -29,7 +29,7 @@

- {{ '{mfa:running_out_info}'|trans({'%numBackupCodesRemaining%':numBackupCodesRemaining}) }} + {{ '{mfa:running_out_info}'|trans({'%numBackupCodesRemaining%': numBackupCodesRemaining}) }}

diff --git a/modules/material/themes/material/mfa/new-backup-codes.twig b/modules/material/themes/material/mfa/new-backup-codes.twig index d095a0e..1b6dd40 100644 --- a/modules/material/themes/material/mfa/new-backup-codes.twig +++ b/modules/material/themes/material/mfa/new-backup-codes.twig @@ -57,7 +57,7 @@

- {{ '{mfa:account}'|trans({'%idpName%':idpName}) }} + {{ '{mfa:account}'|trans({'%idpName%': idpName}) }} {{ "now"|date("M j, Y") }}

diff --git a/modules/material/themes/material/mfa/send-manager-mfa.twig b/modules/material/themes/material/mfa/send-manager-mfa.twig index 1e8a423..f23478a 100644 --- a/modules/material/themes/material/mfa/send-manager-mfa.twig +++ b/modules/material/themes/material/mfa/send-manager-mfa.twig @@ -29,7 +29,7 @@

- {{ '{mfa:manager_info}'|trans({'%managerEmail%':managerEmail})|raw }} + {{ '{mfa:manager_info}'|trans({'%managerEmail%': managerEmail})|raw }}

diff --git a/modules/material/themes/material/profilereview/review.twig b/modules/material/themes/material/profilereview/review.twig index 1f01494..b28cb38 100644 --- a/modules/material/themes/material/profilereview/review.twig +++ b/modules/material/themes/material/profilereview/review.twig @@ -61,14 +61,14 @@ {{ mfa.label }} {% if mfa.type == 'backupcode' %} - {{ '{review:remaining}'|trans({'%count%':mfa.data.count}) }} + {{ '{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}) }} + {{ '{review:used}'|trans({'%when%': mfa.last_used_utc}) }} {% endif %} From 1251a6b8c5eaddeabb64e05740dfee9488a4346c Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:42:45 -0600 Subject: [PATCH 2/2] change twig variables to snake case --- modules/expirychecker/public/about2expire.php | 9 +++---- modules/expirychecker/public/expired.php | 6 ++--- .../src/Auth/Process/ExpiryDate.php | 6 ----- .../themes/material/default/other_mfas.twig | 4 +-- .../material/default/selectidp-links.twig | 4 +-- .../material/expirychecker/about2expire.twig | 6 ++--- .../material/expirychecker/expired.twig | 2 +- .../material/mfa/low-on-backup-codes.twig | 2 +- .../themes/material/mfa/new-backup-codes.twig | 14 +++++----- .../material/mfa/out-of-backup-codes.twig | 4 +-- .../mfa/prompt-for-mfa-backupcode.twig | 6 ++--- .../material/mfa/prompt-for-mfa-manager.twig | 8 +++--- .../material/mfa/prompt-for-mfa-totp.twig | 8 +++--- .../material/mfa/prompt-for-mfa-webauthn.twig | 18 ++++++------- .../themes/material/mfa/send-manager-mfa.twig | 6 ++--- .../material/profilereview/nag-for-mfa.twig | 4 +-- .../themes/material/profilereview/review.twig | 12 ++++----- .../material/silauth/loginuserpass.twig | 26 +++++++++---------- modules/mfa/public/low-on-backup-codes.php | 6 ++--- modules/mfa/public/new-backup-codes.php | 12 ++++----- modules/mfa/public/out-of-backup-codes.php | 6 ++--- modules/mfa/public/prompt-for-mfa.php | 24 ++++++++--------- modules/mfa/public/send-manager-mfa.php | 9 +++---- modules/profilereview/public/nag.php | 8 +++--- modules/profilereview/public/review.php | 6 ++--- modules/silauth/public/loginuserpass.php | 23 +++++----------- 26 files changed, 108 insertions(+), 131 deletions(-) diff --git a/modules/expirychecker/public/about2expire.php b/modules/expirychecker/public/about2expire.php index 05f2de1..7200a7b 100644 --- a/modules/expirychecker/public/about2expire.php +++ b/modules/expirychecker/public/about2expire.php @@ -55,12 +55,9 @@ $globalConfig = Configuration::getInstance(); $t = new Template($globalConfig, 'expirychecker:about2expire'); -$t->data['formTarget'] = Module::getModuleURL('expirychecker/about2expire.php'); -$t->data['formData'] = ['StateId' => $stateId]; -$t->data['daysLeft'] = $state['daysLeft']; -$t->data['dayOrDays'] = (intval($state['daysLeft']) === 1 ? 'day' : 'days'); -$t->data['expiresAtTimestamp'] = $state['expiresAtTimestamp']; -$t->data['accountName'] = $state['accountName']; +$t->data['form_target'] = Module::getModuleURL('expirychecker/about2expire.php'); +$t->data['form_data'] = ['StateId' => $stateId]; +$t->data['days_left'] = $state['daysLeft']; $t->send(); Logger::info('expirychecker - User has been warned that their password will expire soon.'); diff --git a/modules/expirychecker/public/expired.php b/modules/expirychecker/public/expired.php index 07f8a55..95c42d4 100644 --- a/modules/expirychecker/public/expired.php +++ b/modules/expirychecker/public/expired.php @@ -48,10 +48,8 @@ $globalConfig = Configuration::getInstance(); $t = new Template($globalConfig, 'expirychecker:expired'); -$t->data['formTarget'] = Module::getModuleURL('expirychecker/expired.php'); -$t->data['formData'] = ['StateId' => $stateId]; -$t->data['expiresAtTimestamp'] = $state['expiresAtTimestamp']; -$t->data['accountName'] = $state['accountName']; +$t->data['form_target'] = Module::getModuleURL('expirychecker/expired.php'); +$t->data['form_data'] = ['StateId' => $stateId]; $t->send(); Logger::info('expirychecker - User has been told that their password has expired.'); diff --git a/modules/expirychecker/src/Auth/Process/ExpiryDate.php b/modules/expirychecker/src/Auth/Process/ExpiryDate.php index 8503f16..c055a20 100644 --- a/modules/expirychecker/src/Auth/Process/ExpiryDate.php +++ b/modules/expirychecker/src/Auth/Process/ExpiryDate.php @@ -242,8 +242,6 @@ public function redirect2PasswordChange( ): void { $sessionType = 'expirychecker'; /* Save state and redirect. */ - $state['expiresAtTimestamp'] = $expiryTimestamp; - $state['accountName'] = $accountName; $id = State::saveState( $state, 'expirychecker:redirected_to_password_change_url' @@ -359,8 +357,6 @@ public function redirectToExpiredPage(array &$state, string $accountName, int $e ])); /* Save state and redirect. */ - $state['expiresAtTimestamp'] = $expiryTimestamp; - $state['accountName'] = $accountName; $state['passwordChangeUrl'] = $this->passwordChangeUrl; $state['originalUrlParam'] = $this->originalUrlParam; @@ -396,8 +392,6 @@ protected function redirectToWarningPage(array &$state, string $accountName, int } /* Save state and redirect. */ - $state['expiresAtTimestamp'] = $expiryTimestamp; - $state['accountName'] = $accountName; $state['passwordChangeUrl'] = $this->passwordChangeUrl; $state['originalUrlParam'] = $this->originalUrlParam; diff --git a/modules/material/themes/material/default/other_mfas.twig b/modules/material/themes/material/default/other_mfas.twig index f333cdd..1922a0f 100644 --- a/modules/material/themes/material/default/other_mfas.twig +++ b/modules/material/themes/material/default/other_mfas.twig @@ -1,4 +1,4 @@ -{% if otherOptions|length > 0 %} +{% if other_options|length > 0 %}
{# used type=button to avoid form submission on click since this is just used to display the ul #}
    - {% for option in otherOptions %} + {% for option in other_options %} {# TODO: Non-interactive elements should not be assigned mouse or keyboard event listeners. #}
  • diff --git a/modules/material/themes/material/default/selectidp-links.twig b/modules/material/themes/material/default/selectidp-links.twig index eaa4fe4..2f91b16 100644 --- a/modules/material/themes/material/default/selectidp-links.twig +++ b/modules/material/themes/material/default/selectidp-links.twig @@ -37,9 +37,9 @@
    - {% if helpCenterUrl is defined and helpCenterUrl is not empty %} + {% if help_center_url is defined and help_center_url is not empty %} diff --git a/modules/material/themes/material/expirychecker/about2expire.twig b/modules/material/themes/material/expirychecker/about2expire.twig index a6468ea..b4561ce 100644 --- a/modules/material/themes/material/expirychecker/about2expire.twig +++ b/modules/material/themes/material/expirychecker/about2expire.twig @@ -16,15 +16,15 @@
    - {% for name, value in formData %} + {% for name, value in form_data %} {% endfor %}

    - {% if daysLeft < 2 %} + {% if days_left < 2 %} {{ '{about2expire:expiring_in_a_day}'|trans }} {% else %} - {{ '{about2expire:expiring_soon}'|trans({'%daysLeft%': daysLeft}) }} + {{ '{about2expire:expiring_soon}'|trans({'%daysLeft%': days_left}) }} {% endif %}

    diff --git a/modules/material/themes/material/expirychecker/expired.twig b/modules/material/themes/material/expirychecker/expired.twig index e0cbf91..4001396 100644 --- a/modules/material/themes/material/expirychecker/expired.twig +++ b/modules/material/themes/material/expirychecker/expired.twig @@ -16,7 +16,7 @@
    - {% for name, value in formData %} + {% for name, value in form_data %} {% endfor %} diff --git a/modules/material/themes/material/mfa/low-on-backup-codes.twig b/modules/material/themes/material/mfa/low-on-backup-codes.twig index dcaff9d..adabba1 100644 --- a/modules/material/themes/material/mfa/low-on-backup-codes.twig +++ b/modules/material/themes/material/mfa/low-on-backup-codes.twig @@ -29,7 +29,7 @@

    - {{ '{mfa:running_out_info}'|trans({'%numBackupCodesRemaining%': numBackupCodesRemaining}) }} + {{ '{mfa:running_out_info}'|trans({'%numBackupCodesRemaining%': num_backup_codes_remaining}) }}

    diff --git a/modules/material/themes/material/mfa/new-backup-codes.twig b/modules/material/themes/material/mfa/new-backup-codes.twig index 1b6dd40..581520e 100644 --- a/modules/material/themes/material/mfa/new-backup-codes.twig +++ b/modules/material/themes/material/mfa/new-backup-codes.twig @@ -40,7 +40,7 @@
    - {% if newBackupCodes is not empty %} + {% if new_backup_codes is not empty %}

    {{ '{mfa:new_codes_header}'|trans }}

    @@ -57,12 +57,12 @@

    - {{ '{mfa:account}'|trans({'%idpName%': idpName}) }} + {{ '{mfa:account}'|trans({'%idpName%': idp_name}) }} {{ "now"|date("M j, Y") }}

    - {% for newCode in newBackupCodes %} + {% for newCode in new_backup_codes %} ☐ {{ newCode }} {% endfor %}
    @@ -90,8 +90,8 @@ {{ '{mfa:button_download}'|trans }} @@ -112,7 +112,7 @@
    @@ -131,7 +131,7 @@
diff --git a/modules/material/themes/material/mfa/out-of-backup-codes.twig b/modules/material/themes/material/mfa/out-of-backup-codes.twig index 4eb199e..e4e2cfa 100644 --- a/modules/material/themes/material/mfa/out-of-backup-codes.twig +++ b/modules/material/themes/material/mfa/out-of-backup-codes.twig @@ -29,7 +29,7 @@

- {% if hasOtherMfaOptions %} + {% if has_other_mfa_options %} {{ '{mfa:has_options_besides_codes}'|trans }} {% else %} {{ '{mfa:has_no_more_options}'|trans }} @@ -38,7 +38,7 @@

- {% if hasOtherMfaOptions %} + {% if has_other_mfa_options %} diff --git a/modules/material/themes/material/mfa/prompt-for-mfa-backupcode.twig b/modules/material/themes/material/mfa/prompt-for-mfa-backupcode.twig index 8dbf08a..a3c03c7 100644 --- a/modules/material/themes/material/mfa/prompt-for-mfa-backupcode.twig +++ b/modules/material/themes/material/mfa/prompt-for-mfa-backupcode.twig @@ -42,19 +42,19 @@
- {% if errorMessage is not empty %} + {% if error_message is not empty %}

error - {{ errorMessage|e }} + {{ error_message|e }}

{% endif %} diff --git a/modules/material/themes/material/mfa/prompt-for-mfa-manager.twig b/modules/material/themes/material/mfa/prompt-for-mfa-manager.twig index 48d8ef8..68e7fec 100644 --- a/modules/material/themes/material/mfa/prompt-for-mfa-manager.twig +++ b/modules/material/themes/material/mfa/prompt-for-mfa-manager.twig @@ -29,7 +29,7 @@

- {{ '{mfa:manager_sent}'|trans({'%managerEmail%': managerEmail}) }} + {{ '{mfa:manager_sent}'|trans({'%managerEmail%': manager_email}) }}

@@ -42,19 +42,19 @@
- {% if errorMessage is not empty %} + {% if error_message is not empty %}

error - {{ errorMessage|e }} + {{ error_message|e }}

{% endif %} diff --git a/modules/material/themes/material/mfa/prompt-for-mfa-totp.twig b/modules/material/themes/material/mfa/prompt-for-mfa-totp.twig index d95926f..8353bbb 100644 --- a/modules/material/themes/material/mfa/prompt-for-mfa-totp.twig +++ b/modules/material/themes/material/mfa/prompt-for-mfa-totp.twig @@ -28,7 +28,7 @@
- {{ '{mfa:account}'|trans({'%idpName%': idpName}) }} + {{ '{mfa:account}'|trans({'%idpName%': idp_name}) }}
@@ -40,19 +40,19 @@
- {% if errorMessage is not empty %} + {% if error_message is not empty %}

error - {{ errorMessage|e }} + {{ error_message|e }}

{% endif %} diff --git a/modules/material/themes/material/mfa/prompt-for-mfa-webauthn.twig b/modules/material/themes/material/mfa/prompt-for-mfa-webauthn.twig index df53e36..0e0680e 100644 --- a/modules/material/themes/material/mfa/prompt-for-mfa-webauthn.twig +++ b/modules/material/themes/material/mfa/prompt-for-mfa-webauthn.twig @@ -5,11 +5,11 @@ {{ include('header.twig') }} - + - +
@@ -88,7 +88,7 @@
- {% if supportsWebAuthn %} + {% if supports_web_authn %}

{{ '{mfa:webauthn_instructions}'|trans }} @@ -102,17 +102,17 @@

{% endif %} - {% if errorMessage is not empty %} + {% if error_message is not empty %} {% endif %}
-

+

error - {{ errorMessage|e }} + {{ error_message|e }}

@@ -123,7 +123,7 @@ diff --git a/modules/material/themes/material/mfa/send-manager-mfa.twig b/modules/material/themes/material/mfa/send-manager-mfa.twig index f23478a..db96bca 100644 --- a/modules/material/themes/material/mfa/send-manager-mfa.twig +++ b/modules/material/themes/material/mfa/send-manager-mfa.twig @@ -29,17 +29,17 @@

- {{ '{mfa:manager_info}'|trans({'%managerEmail%': managerEmail})|raw }} + {{ '{mfa:manager_info}'|trans({'%managerEmail%': manager_email})|raw }}

- {% if errorMessage is not empty %} + {% if error_message is not empty %}

error - {{ errorMessage|e }} + {{ error_message|e }}

diff --git a/modules/material/themes/material/profilereview/nag-for-mfa.twig b/modules/material/themes/material/profilereview/nag-for-mfa.twig index bf0a6f3..b39eed5 100644 --- a/modules/material/themes/material/profilereview/nag-for-mfa.twig +++ b/modules/material/themes/material/profilereview/nag-for-mfa.twig @@ -40,9 +40,9 @@ - {% if mfaLearnMoreUrl is not empty %} + {% if mfa_learn_more_url is not empty %}
- {% if mfaOptions|length > 0 %} + {% if mfa_options|length > 0 %}

@@ -53,7 +53,7 @@
    - {% for mfa in mfaOptions %} + {% for mfa in mfa_options %}
  • @@ -79,11 +79,11 @@
{% endif %} - {% if methodOptions|length > 0 %} + {% if method_options|length > 0 %}
@@ -95,7 +95,7 @@
    - {% for method in methodOptions %} + {% for method in method_options %}
  • @@ -116,7 +116,7 @@

- {{ '{review:button_update}'|trans }} launch diff --git a/modules/material/themes/material/silauth/loginuserpass.twig b/modules/material/themes/material/silauth/loginuserpass.twig index 7f72eca..06ef65e 100644 --- a/modules/material/themes/material/silauth/loginuserpass.twig +++ b/modules/material/themes/material/silauth/loginuserpass.twig @@ -1,7 +1,7 @@ - {{ '{login:title}'|trans({'%idpName%': idpName}) }} + {{ '{login:title}'|trans({'%idpName%': idp_name}) }} {{ include('header.twig') }} @@ -11,7 +11,7 @@ } - {% if siteKey is not empty %} + {% if site_key is not empty %}