added otp superusers help tooltip

This commit is contained in:
Gani Georgiev
2026-04-19 01:19:38 +03:00
parent 07679dd5ba
commit 3b49e8489e
3 changed files with 22 additions and 3 deletions

View File

@@ -13,6 +13,9 @@ export function otpAccordion(collection) {
return collection.otp;
},
get isSuperusers() {
return collection.system && collection.name == "_superusers";
},
});
return t.details(
@@ -52,12 +55,28 @@ export function otpAccordion(collection) {
name: "otp.enabled",
className: "switch",
checked: () => data.config.enabled,
onchange: (e) => (data.config.enabled = e.target.checked),
onchange: (e) => {
data.config.enabled = e.target.checked;
if (data.isSuperusers) {
collection.mfa.enabled = e.target.checked;
}
},
}),
t.label({
htmlFor: uniqueId + ".enabled",
textContent: "Enable",
}),
() => {
if (!data.isSuperusers) {
return
}
return t.i({
className: "ri-information-line link-hint",
ariaDescription: app.attrs.tooltip("Superusers can have OTP only as part of Two-factor authentication."),
})
},
),
),
t.div(