Skip to content

Commit

Permalink
define variables needed in the header template
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Jul 8, 2024
1 parent dfc6b6e commit dc5f782
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 7 deletions.
2 changes: 2 additions & 0 deletions modules/expirychecker/public/about2expire.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
$globalConfig = Configuration::getInstance();

$t = new Template($globalConfig, 'expirychecker:about2expire');
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['form_target'] = Module::getModuleURL('expirychecker/about2expire.php');
$t->data['form_data'] = ['StateId' => $stateId];
$t->data['days_left'] = $state['daysLeft'];
Expand Down
2 changes: 2 additions & 0 deletions modules/expirychecker/public/expired.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
$globalConfig = Configuration::getInstance();

$t = new Template($globalConfig, 'expirychecker:expired');
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['form_target'] = Module::getModuleURL('expirychecker/expired.php');
$t->data['form_data'] = ['StateId' => $stateId];
$t->send();
Expand Down
9 changes: 4 additions & 5 deletions modules/material/themes/material/default/header.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

<base href="{{ baseurlpath }}/module.php/material/">

{% if analyticsTrackingId is defined and analyticsTrackingId is not empty %}
{% if analytics_tracking_id is not empty %}
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ analyticsTrackingId }}"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ analytics_tracking_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
Expand All @@ -17,12 +17,11 @@
gtag('js', new Date());
gtag('config', '{{ analyticsTrackingId }}');
gtag('config', '{{ analytics_tracking_id }}');
</script>
{% endif %}

{# FIXME: <link rel="stylesheet" href="material.{{ theme.color-scheme | e ?: 'indigo-purple' }}.1.2.1.min.css"> #}
<link rel="stylesheet" href="material.indigo-purple.1.2.1.min.css">
<link rel="stylesheet" href="material.{{ theme_color_scheme | e ?: 'indigo-purple' }}.1.2.1.min.css">
<link rel="stylesheet" href="styles.2.3.6.css">

<script async src="material.1.2.1.min.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions modules/mfa/public/low-on-backup-codes.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
$globalConfig = Configuration::getInstance();

$t = new Template($globalConfig, 'mfa:low-on-backup-codes');
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['num_backup_codes_remaining'] = $state['numBackupCodesRemaining'];
$t->send();

Expand Down
6 changes: 4 additions & 2 deletions modules/mfa/public/must-set-up-mfa.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use SimpleSAML\Module\mfa\LoggerFactory;
use SimpleSAML\Auth\State;
use SimpleSAML\Configuration;
use SimpleSAML\Error\BadRequest;
use SimpleSAML\XHTML\Template;
use SimpleSAML\Module\mfa\Auth\Process\Mfa;
use SimpleSAML\Module\mfa\LoggerFactory;
use SimpleSAML\XHTML\Template;

$stateId = filter_input(INPUT_GET, 'StateId') ?? null;
if (empty($stateId)) {
Expand All @@ -24,6 +24,8 @@
$globalConfig = Configuration::getInstance();

$t = new Template($globalConfig, 'mfa:must-set-up-mfa');
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->send();

$logger->info(sprintf(
Expand Down
2 changes: 2 additions & 0 deletions modules/mfa/public/new-backup-codes.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
$globalConfig = Configuration::getInstance();

$t = new Template($globalConfig, 'mfa:new-backup-codes');
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['mfa_setup_url'] = $state['mfaSetupUrl'];
$t->data['new_backup_codes'] = $state['newBackupCodes'] ?? [];
$t->data['idp_name'] = $globalConfig->getString('idp_display_name');
Expand Down
2 changes: 2 additions & 0 deletions modules/mfa/public/out-of-backup-codes.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
$globalConfig = Configuration::getInstance();

$t = new Template($globalConfig, 'mfa:out-of-backup-codes');
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['has_other_mfa_options'] = $hasOtherMfaOptions;
$t->send();

Expand Down
2 changes: 2 additions & 0 deletions modules/mfa/public/prompt-for-mfa.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@
$mfaTemplateToUse = Mfa::getTemplateFor($mfaOption['type']);

$t = new Template($globalConfig, $mfaTemplateToUse);
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['error_message'] = $errorMessage ?? null;
$t->data['mfa_option_data'] = json_encode($mfaOption['data']);
$t->data['mfa_options'] = $mfaOptions;
Expand Down
2 changes: 2 additions & 0 deletions modules/mfa/public/send-manager-mfa.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
$globalConfig = Configuration::getInstance();

$t = new Template($globalConfig, 'mfa:send-manager-mfa');
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['manager_email'] = $state['managerEmail'];
$t->data['error_message'] = $errorMessage ?? null;
$t->send();
Expand Down
2 changes: 2 additions & 0 deletions modules/profilereview/public/nag.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
$globalConfig = Configuration::getInstance();

$t = new Template($globalConfig, 'profilereview:' . $state['template']);
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['profile_url'] = $state['profileUrl'];
$t->data['method_options'] = $state['methodOptions'] ?? [];
$t->data['mfa_options'] = $state['mfaOptions'] ?? [];
Expand Down
2 changes: 2 additions & 0 deletions modules/profilereview/public/review.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
$globalConfig = Configuration::getInstance();

$t = new Template($globalConfig, 'profilereview:review');
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['profile_url'] = $state['profileUrl'];
$t->data['method_options'] = $state['methodOptions'];
$t->data['mfa_options'] = $state['mfaOptions'];
Expand Down
2 changes: 2 additions & 0 deletions modules/silauth/public/loginuserpass.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
}

$t = new Template($globalConfig, 'silauth:loginuserpass');
$t->data['theme_color_scheme'] = $globalConfig->getOptionalString('theme.color-scheme', '');
$t->data['analytics_tracking_id'] = $globalConfig->getOptionalString('analytics.trackingId', '');
$t->data['stateparams'] = array('AuthState' => $authStateId);
$t->data['username'] = $username;
$t->data['errorcode'] = $errorCode;
Expand Down

0 comments on commit dc5f782

Please sign in to comment.