diff --git a/src/api/web.rs b/src/api/web.rs index d8e35009..98d51a5e 100644 --- a/src/api/web.rs +++ b/src/api/web.rs @@ -64,6 +64,7 @@ fn vaultwarden_css() -> Cached> { "sso_enabled": CONFIG.sso_enabled(), "sso_only": CONFIG.sso_enabled() && CONFIG.sso_only(), "yubico_enabled": CONFIG._enable_yubico() && CONFIG.yubico_client_id().is_some() && CONFIG.yubico_secret_key().is_some(), + "webauthn_2fa_supported": CONFIG.is_webauthn_2fa_supported(), }); let scss = match CONFIG.render_template("scss/vaultwarden.scss", &css_options) { diff --git a/src/config.rs b/src/config.rs index 545d7dce..91f7fe42 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1504,6 +1504,10 @@ impl Config { } } + pub fn is_webauthn_2fa_supported(&self) -> bool { + Url::parse(&self.domain()).expect("DOMAIN not a valid URL").domain().is_some() + } + /// Tests whether the admin token is set to a non-empty value. pub fn is_admin_token_set(&self) -> bool { let token = self.admin_token(); diff --git a/src/static/templates/scss/vaultwarden.scss.hbs b/src/static/templates/scss/vaultwarden.scss.hbs index b031404d..c1c5eec1 100644 --- a/src/static/templates/scss/vaultwarden.scss.hbs +++ b/src/static/templates/scss/vaultwarden.scss.hbs @@ -168,6 +168,13 @@ app-root a[routerlink="/signup"] { } {{/unless}} +{{#unless webauthn_2fa_supported}} +/* Hide `Passkey` 2FA if it is not supported */ +.providers-2fa-7 { + @extend %vw-hide; +} +{{/unless}} + {{#unless emergency_access_allowed}} /* Hide Emergency Access if not allowed */ bit-nav-item[route="settings/emergency-access"] {