From f3ffeae493e783ce10beb1952f6292431c640bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Cort=C3=A9s=20Cano?= <38475681+TrapoSAMA@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:13:02 -0300 Subject: [PATCH] Fix mailbox-user TOTP navigation and overlapping header (#1194) Mailbox users now go to users/totp-exceptions.php for TOTP Excemptions. Fix navigation bar / logo overlapping. thanks @TrapoSAMA --- CHANGELOG.TXT | 1 + configs/menu.conf | 2 +- templates/users_menu.tpl | 96 +++++++++++-------------- tests/MailboxNavigationTemplateTest.php | 62 ++++++++++++++++ 4 files changed, 104 insertions(+), 57 deletions(-) create mode 100644 tests/MailboxNavigationTemplateTest.php diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 1d936ece..96927819 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -8,6 +8,7 @@ Changes in 'master' (not in a release yet) (20XX/XX/XX) -------------------------- + - Restore mailbox-user TOTP exception links and use the shared navigation header without overlapping logos. - Enforce managed-domain authorization for administrator TOTP self-exceptions, including partial edits. - Follow up security search filtering, password-recovery messages and password confirmation for TOTP exception forms. - Populate TOTP actions for each returned administrator or mailbox and handle empty account lists. diff --git a/configs/menu.conf b/configs/menu.conf index 07f3dfbc..120fd8ad 100644 --- a/configs/menu.conf +++ b/configs/menu.conf @@ -43,7 +43,7 @@ url_user_vacation = vacation.php url_user_password = password.php url_user_edit_name = ../edit.php?table=mailboxname url_user_totp = totp.php -url_user_totp_exceptions = ../list.php?table=totpexception +url_user_totp_exceptions = totp-exceptions.php url_user_logout = login.php diff --git a/templates/users_menu.tpl b/templates/users_menu.tpl index ab44944e..c11d5205 100644 --- a/templates/users_menu.tpl +++ b/templates/users_menu.tpl @@ -1,57 +1,41 @@ - +
  • {$PALANG.pMenu_logout}
  • + + diff --git a/tests/MailboxNavigationTemplateTest.php b/tests/MailboxNavigationTemplateTest.php new file mode 100644 index 00000000..8d151f1d --- /dev/null +++ b/tests/MailboxNavigationTemplateTest.php @@ -0,0 +1,62 @@ + ['username' => 'user@example.com']]; + try { + foreach (['en', 'es'] as $language) { + $PALANG = []; + require __DIR__ . '/../languages/' . $language . '.lang'; + $_SESSION['lang'] = $language; + foreach (['YES', 'NO'] as $totp) { + $smarty = new \Smarty\Smarty(); + $smarty->setCompileDir(sys_get_temp_dir()); + $smarty->setTemplateDir(__DIR__ . '/../templates'); + $smarty->setConfigDir(__DIR__ . '/../configs'); + $smarty->assign([ + 'CONF' => [ + 'theme_logo' => '../images/corporate-logo.png', 'theme_favicon' => '', + 'theme_css' => '../css/bootstrap.css', 'theme_custom_css' => '', + 'vacation' => 'YES', 'edit_alias' => 'YES', 'totp' => $totp, + 'app_passwords' => 'NO', 'motd_user' => '', 'show_footer_text' => 'NO', + ], + 'PALANG' => $PALANG, 'rel_path' => '../', 'version' => 'test', + 'authentication_has_role' => ['user' => true, 'admin' => false, 'global_admin' => false], + 'user_can_edit_mailbox_name' => false, 'tummVacationtext' => 'Vacation', + 'smarty_template' => 'users_main', + ]); + $html = $smarty->fetch('index.tpl'); + $document = new DOMDocument(); + @$document->loadHTML($html); + $xpath = new DOMXPath($document); + self::assertSame(1, $xpath->query('//nav')->length); + self::assertSame(1, $xpath->query('//*[@id="login_header_logo"]')->length); + self::assertSame('../images/corporate-logo.png', $xpath->query('//*[@id="login_header_logo"]')->item(0)->getAttribute('src')); + self::assertSame(1, $xpath->query('//*[@id="darkModeSwitch"]')->length); + self::assertSame(1, $xpath->query('//*[@id="navbarSupportedContent"]')->length); + self::assertSame(1, $xpath->query('//button[@data-bs-target="#navbarSupportedContent"]')->length); + self::assertSame(0, $xpath->query('//nav[contains(@class, "fixed-top")]')->length); + self::assertSame($totp === 'YES' ? 2 : 0, $xpath->query('//a[@href="totp-exceptions.php"]')->length); + self::assertSame(0, $xpath->query('//a[contains(@href, "table=totpexception")]')->length); + } + } + } finally { + $_SESSION = $session; + if ($host === null) { + unset($_SERVER['HTTP_HOST']); + } else { + $_SERVER['HTTP_HOST'] = $host; + } + } + } +}