From 4c39e793cd3ca90d0ae86aabd5438afa35083f60 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Fri, 1 Apr 2022 15:05:26 +0200 Subject: [PATCH] Add account: check length of issuer and name --- lib/oath/views/add_account_page.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/oath/views/add_account_page.dart b/lib/oath/views/add_account_page.dart index f65b896b..35a00f74 100755 --- a/lib/oath/views/add_account_page.dart +++ b/lib/oath/views/add_account_page.dart @@ -104,8 +104,11 @@ class _OathAddAccountPageState extends ConsumerState { final secret = _secretController.text.replaceAll(' ', ''); final secretLengthValid = secret.length * 5 % 8 < 5; - final isValid = - _accountController.text.isNotEmpty && secret.isNotEmpty && period > 0; + final isValid = _accountController.text.isNotEmpty && + secret.isNotEmpty && + issuerRemaining >= -1 && + nameRemaining >= 0 && + period > 0; final qrScanner = ref.watch(qrScannerProvider); @@ -154,7 +157,7 @@ class _OathAddAccountPageState extends ConsumerState { ), TextField( controller: _accountController, - maxLength: nameRemaining, + maxLength: max(nameRemaining, 1), decoration: const InputDecoration( border: OutlineInputBorder(), labelText: 'Account name',