From 0f55b1a366f846f092abd72539bbecc096235454 Mon Sep 17 00:00:00 2001 From: tom27052006 <83423411+tom27052006@users.noreply.github.com> Date: Tue, 22 Sep 2026 09:19:45 +0200 Subject: [PATCH] Hide the whole change-email section when EMAIL_CHANGE_ALLOWED is false --- src/api/web.rs | 1 + src/static/templates/scss/vaultwarden.scss.hbs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/api/web.rs b/src/api/web.rs index d6d8d62c..aa67e614 100644 --- a/src/api/web.rs +++ b/src/api/web.rs @@ -89,6 +89,7 @@ fn vaultwarden_css() -> EtagCached> { // Else, there is either no cache, or reload_templates is true and we need to rebuild the CSS let css_options = json!({ + "email_change_allowed": CONFIG.email_change_allowed(), "emergency_access_allowed": CONFIG.emergency_access_allowed(), "load_user_scss": true, "mail_2fa_enabled": CONFIG._enable_email_2fa(), diff --git a/src/static/templates/scss/vaultwarden.scss.hbs b/src/static/templates/scss/vaultwarden.scss.hbs index 5bbe5db2..4b83ba04 100644 --- a/src/static/templates/scss/vaultwarden.scss.hbs +++ b/src/static/templates/scss/vaultwarden.scss.hbs @@ -220,6 +220,13 @@ auth-input-password > form > bit-form-field:nth-child(4) { @extend %vw-hide; } {{/unless}} + +{{#unless email_change_allowed}} +/* Hide the whole `Change email` section, including its heading, if not allowed */ +div:has(> app-change-email) { + @extend %vw-hide; +} +{{/unless}} /**** End Dynamic Vaultwarden Changes ****/ /**** Include a special user stylesheet for custom changes ****/ {{#if load_user_scss}}