feat: numeric one-time password (#11846)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-05-23 17:10:47 +08:00
committed by GitHub
parent 6ff679c6b4
commit 3c028fe5b5
51 changed files with 110 additions and 3 deletions

View File

@@ -56,6 +56,10 @@ class _DropDownAction extends StatelessWidget {
final verificationMethod = gFFI.serverModel.verificationMethod;
final showPasswordOption = approveMode != 'click';
final isApproveModeFixed = isOptionFixed(kOptionApproveMode);
final isNumericOneTimePasswordFixed =
isOptionFixed(kOptionAllowNumericOneTimePassword);
final isAllowNumericOneTimePassword =
gFFI.serverModel.allowNumericOneTimePassword;
return [
PopupMenuItem(
enabled: gFFI.serverModel.connectStatus > 0,
@@ -94,6 +98,14 @@ class _DropDownAction extends StatelessWidget {
value: "setTemporaryPasswordLength",
child: Text(translate("One-time password length")),
),
if (showPasswordOption &&
verificationMethod != kUsePermanentPassword)
PopupMenuItem(
value: "allowNumericOneTimePassword",
child: listTile(translate("Numeric one-time password"),
isAllowNumericOneTimePassword),
enabled: !isNumericOneTimePasswordFixed,
),
if (showPasswordOption) const PopupMenuDivider(),
if (showPasswordOption)
PopupMenuItem(
@@ -124,6 +136,9 @@ class _DropDownAction extends StatelessWidget {
setPasswordDialog();
} else if (value == "setTemporaryPasswordLength") {
setTemporaryPasswordLengthDialog(gFFI.dialogManager);
} else if (value == "allowNumericOneTimePassword") {
gFFI.serverModel.switchAllowNumericOneTimePassword();
gFFI.serverModel.updatePasswordModel();
} else if (value == kUsePermanentPassword ||
value == kUseTemporaryPassword ||
value == kUseBothPasswords) {