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

@@ -1097,6 +1097,34 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
))
.toList();
final isOptFixedNumOTP =
isOptionFixed(kOptionAllowNumericOneTimePassword);
final isNumOPTChangable = !isOptFixedNumOTP && tmpEnabled && !locked;
final numericOneTimePassword = GestureDetector(
child: InkWell(
child: Row(
children: [
Checkbox(
value: model.allowNumericOneTimePassword,
onChanged: isNumOPTChangable
? (bool? v) {
model.switchAllowNumericOneTimePassword();
}
: null)
.marginOnly(right: 5),
Expanded(
child: Text(
translate('Numeric one-time password'),
style: TextStyle(
color: disabledTextColor(context, isNumOPTChangable)),
))
],
)),
onTap: isNumOPTChangable
? () => model.switchAllowNumericOneTimePassword()
: null,
).marginOnly(left: _kContentHSubMargin - 5);
final modeKeys = <String>[
'password',
'click',
@@ -1133,6 +1161,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
],
),
enabled: tmpEnabled && !locked),
numericOneTimePassword,
if (usePassword) radios[1],
if (usePassword)
_SubButton('Set permanent password', setPasswordDialog,