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

@@ -36,6 +36,7 @@ class ServerModel with ChangeNotifier {
int _connectStatus = 0; // Rendezvous Server status
String _verificationMethod = "";
String _temporaryPasswordLength = "";
bool _allowNumericOneTimePassword = false;
String _approveMode = "";
int _zeroClientLengthCounter = 0;
@@ -112,6 +113,12 @@ class ServerModel with ChangeNotifier {
*/
}
bool get allowNumericOneTimePassword => _allowNumericOneTimePassword;
switchAllowNumericOneTimePassword() async {
await mainSetBoolOption(
kOptionAllowNumericOneTimePassword, !_allowNumericOneTimePassword);
}
TextEditingController get serverId => _serverId;
TextEditingController get serverPasswd => _serverPasswd;
@@ -227,6 +234,8 @@ class ServerModel with ChangeNotifier {
final temporaryPasswordLength =
await bind.mainGetOption(key: "temporary-password-length");
final approveMode = await bind.mainGetOption(key: kOptionApproveMode);
final numericOneTimePassword =
await mainGetBoolOption(kOptionAllowNumericOneTimePassword);
/*
var hideCm = option2bool(
'allow-hide-cm', await bind.mainGetOption(key: 'allow-hide-cm'));
@@ -265,6 +274,10 @@ class ServerModel with ChangeNotifier {
_temporaryPasswordLength = temporaryPasswordLength;
update = true;
}
if (_allowNumericOneTimePassword != numericOneTimePassword) {
_allowNumericOneTimePassword = numericOneTimePassword;
update = true;
}
/*
if (_hideCm != hideCm) {
_hideCm = hideCm;
@@ -817,8 +830,8 @@ class Client {
RxInt unreadChatMessageCount = 0.obs;
Client(this.id, this.authorized, this.isFileTransfer, this.isViewCamera, this.name, this.peerId,
this.keyboard, this.clipboard, this.audio);
Client(this.id, this.authorized, this.isFileTransfer, this.isViewCamera,
this.name, this.peerId, this.keyboard, this.clipboard, this.audio);
Client.fromJson(Map<String, dynamic> json) {
id = json['id'];