mailcow/data/web/templates
Stephen Ritz 4cba448671 [Web] translate password errors in the forced password change modal
The forced password change modal posts to the JSON API and renders
data[0].msg directly. The API returns raw language keys rather than
translated strings, so a user who fails the complexity policy is shown
the literal text "password_complexity" instead of a message.

Every other password form renders errors through alertbox_log_parser(),
which resolves the key against $lang. The modal is the only one that
talks to the API directly, and it never resolved the key.

Resolve it against lang_danger, which base.twig already exposes for this
purpose. This also covers password_mismatch, password_empty and
access_denied, and applies to the admin path as well. Unknown keys still
fall through unchanged.

The lookup is guarded with hasOwnProperty because msg is attacker-
independent but dynamic: a bare lang_danger[msg] would resolve inherited
Object.prototype members such as "constructor" to a function, which
jQuery's .text() would then invoke as a callback.

Language files are untouched: prerequisites.inc.php loads lang.en-gb.json
as the base and merges the active locale over it, so locales that lack the
key inherit the English string.

Fixes #7301

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 15:11:17 -07:00
..
admin [netfilter] fix negative timer, no unbanning of IPs (#6575) 2025-07-16 10:08:55 +02:00
cache Readded .gitkeep in data/web/templates/cache 2022-05-05 17:25:04 +02:00
edit Fix force_tfa not available in mailbox template #7216 2026-06-07 17:03:52 +02:00
mailbox [Web] Add missing EAS and DAV protocol options to mailbox bulk actions 2026-03-03 14:39:41 +01:00
modals [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
oauth [BS5] change form-group 2022-04-13 14:07:07 +02:00
user [Web] Allow admins to limit EAS and DAV access for mailbox users 2026-01-28 09:49:33 +01:00
admin_index.twig [Web] Add quick links to other login pages and option to disable mailcow login form 2025-05-09 15:13:44 +02:00
admin.twig Merge remote-tracking branch 'origin/staging' into nightly 2024-08-15 12:45:52 +02:00
base.twig [Web] translate password errors in the forced password change modal 2026-07-14 15:11:17 -07:00
dashboard.twig Merge branch 'nightly' into feat/nightly-separated-login 2025-01-27 16:37:09 +01:00
domainadmin_index.twig [Web] Add quick links to other login pages and option to disable mailcow login form 2025-05-09 15:13:44 +02:00
domainadmin.twig [Web] organize user landing 2024-02-08 12:42:03 +01:00
edit.twig [Web][Rspamd] implement custom mailbox attributes and improve domain wide footer 2023-11-23 16:12:43 +01:00
fido2.twig [Web] mobile devices styling fixes and enhancements 2023-09-03 18:36:32 +02:00
mailbox.twig [Web] add missing translation for ratelimit in templates overview 2024-11-20 09:57:14 +01:00
qhandler.twig [BS5] change form-group 2022-04-13 14:07:07 +02:00
quarantine.twig [Web] Set pageLength to pagination_size + repect savedState... 2023-01-25 23:50:39 +01:00
queue.twig [Web] Set pageLength to pagination_size + repect savedState... 2023-01-25 23:50:39 +01:00
reset-password.twig [Web] add function to reset user passwords 2024-07-30 14:46:08 +02:00
tfa_keys.twig [BS5] fix merging bugs 2022-08-30 15:59:16 +02:00
user_domainadmin_common.twig [Web] Set pageLength to pagination_size + repect savedState... 2023-01-25 23:50:39 +01:00
user_index.twig web: rename login placeholder for mailbox to email address (#6693) 2025-08-28 17:02:16 +02:00
user.twig Merge branch 'staging' into nightly 2025-01-23 08:11:45 +01:00