mailcow/data/web
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 [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
api Fix force_tfa not available in mailbox template #7216 2026-06-07 17:03:52 +02:00
css [Web] Use absolute paths for flag SVGs 2025-03-26 10:59:56 +01:00
domainadmin [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
fonts
img
inc Merge pull request #7275 from Snafu/fix/admin-mailbox-tfa-missing 2026-06-11 10:03:39 +02:00
js Fix force_tfa not available in mailbox template #7216 2026-06-07 17:03:52 +02:00
lang Refined wording for displaying of active settings on quarantine page. 2026-07-12 17:22:15 +02:00
oauth
templates [Web] translate password errors in the forced password change modal 2026-07-14 15:11:17 -07:00
_rspamderror.php Enable password protection for Redis 2024-11-19 14:25:31 +01:00
_status.502.html mailcow.github.io -> docs.mailcow.email 2023-09-27 18:34:53 +02:00
autoconfig.php Fixes issue #6489 2025-12-21 16:56:16 +01:00
autodiscover-json.php
autodiscover.php [Web] Add fail2ban logging to passwordless autodiscover endpoint 2026-03-03 13:24:44 +01:00
edit.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
f2b-banlist.php [Web] remove f2b banlist from json_api.php 2024-11-19 14:13:37 +01:00
favicon.png fixed favicon.png (#6570) 2025-08-06 09:42:43 +02:00
index.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
json_api.php Merge pull request #7089 from mailcow/fix/7039 2026-03-03 15:07:17 +01:00
mobileconfig.php Escape generated password in mobileconfig 2026-05-24 11:52:12 +02:00
mta-sts.php Add MTA-STS support for alias domains (#6972) 2025-12-15 16:29:21 +01:00
qhandler.php
quarantine.php
reset-password.php [Web] Fix password reset 2025-04-01 16:39:15 +02:00
resource.php
robots.txt
sogo-auth.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
user.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00