+
-
- ${t("multi_factor_authentication.oauth_user_account")} ${t("multi_factor_authentication.oauth_user_not_logged_in")}
-
- ${t("multi_factor_authentication.oauth_user_email")} ${t("multi_factor_authentication.oauth_user_not_logged_in")}
-
+
+
-
${t("multi_factor_authentication.oauth_description")}
-
+
-
-
${t("multi_factor_authentication.totp_title")}
+
${t("multi_factor_authentication.totp_description")}
-
-
-
-
-
${t("multi_factor_authentication.totp_description")}
-
-
-
-
${t("multi_factor_authentication.totp_secret_title")}
-
-
-
-
-
-
-
-
${t("multi_factor_authentication.recovery_keys_title")}
-
-
${t("multi_factor_authentication.recovery_keys_description")}
-
-
- ${t("multi_factor_authentication.recovery_keys_description_warning")}
-
-
-
-
-
-
-
- |
- |
- |
-
-
- |
- |
- |
-
-
- |
- |
- |
-
-
- |
- |
- |
-
-
-
-
-
-
-
`;
@@ -140,12 +167,23 @@ export default class MultiFactorAuthenticationOptions extends OptionsWidget {
private $envEnabledOAuth!: JQuery
;
private $recoveryKeys: JQuery[] = [];
private $protectedSessionTimeout!: JQuery;
+ private $mfaEnabledCheckbox!: JQuery;
+ private $mfaOptions!: JQuery;
+ private $authMethodRadios!: JQuery;
+ private $totpOptions!: JQuery;
+ private $oauthOptions!: JQuery;
doRender() {
const template = utils.isElectron() ? TPL_ELECTRON : TPL_WEB;
this.$widget = $(template);
if (!utils.isElectron()) {
+ this.$mfaEnabledCheckbox = this.$widget.find(".mfa-enabled-checkbox");
+ this.$mfaOptions = this.$widget.find(".mfa-options");
+ this.$authMethodRadios = this.$widget.find(".auth-method-radio");
+ this.$totpOptions = this.$widget.find(".totp-options");
+ this.$oauthOptions = this.$widget.find(".oauth-options");
+
this.$generateTotpButton = this.$widget.find(".generate-totp");
this.$totpEnabled = this.$widget.find(".totp-enabled");
this.$totpSecret = this.$widget.find(".totp-secret");
@@ -175,6 +213,20 @@ export default class MultiFactorAuthenticationOptions extends OptionsWidget {
});
this.displayRecoveryKeys();
+
+ this.$mfaEnabledCheckbox.on("change", () => {
+ this.$mfaOptions.toggle(this.$mfaEnabledCheckbox.is(":checked"));
+ if (!this.$mfaEnabledCheckbox.is(":checked")) {
+ this.$totpOptions.hide();
+ this.$oauthOptions.hide();
+ }
+ });
+
+ this.$authMethodRadios.on("change", () => {
+ const selectedMethod = this.$authMethodRadios.filter(":checked").val();
+ this.$totpOptions.toggle(selectedMethod === "totp");
+ this.$oauthOptions.toggle(selectedMethod === "oauth");
+ });
}
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index 52609a05e..21e5874c4 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -1313,6 +1313,8 @@
"multi_factor_authentication": {
"title": "Multi-Factor Authentication",
"description": "Multi-Factor Authentication (MFA) adds an extra layer of security to your account. Instead of just entering a password to log in, MFA requires you to provide one or more additional pieces of evidence to verify your identity. This way, even if someone gets hold of your password, they still can't access your account without the second piece of information. It's like adding an extra lock to your door, making it much harder for anyone else to break in.",
+ "mfa_enabled": "Enable Multi-Factor Authentication",
+ "mfa_method": "MFA Method",
"electron_disabled": "Multi-Factor Authentication is not supported in the desktop build currently.",
"oauth_title": "OAuth/OpenID",
"oauth_enabled": "OAuth/OpenID Enabled",