From c0772dc9ebaec18c719374a9298e58fd59f7d3d8 Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Tue, 14 Mar 2023 15:24:41 +0100 Subject: [PATCH 1/2] add auto fill hints to secret input fields --- lib/fido/views/locked_page.dart | 1 + lib/fido/views/pin_dialog.dart | 3 +++ lib/oath/views/add_account_page.dart | 1 + lib/oath/views/manage_password_dialog.dart | 3 +++ lib/oath/views/unlock_form.dart | 1 + 5 files changed, 9 insertions(+) diff --git a/lib/fido/views/locked_page.dart b/lib/fido/views/locked_page.dart index 2a0fa837..80839119 100755 --- a/lib/fido/views/locked_page.dart +++ b/lib/fido/views/locked_page.dart @@ -145,6 +145,7 @@ class _PinEntryFormState extends ConsumerState<_PinEntryForm> { child: TextField( autofocus: true, obscureText: _isObscure, + autofillHints: const [AutofillHints.password], controller: _pinController, decoration: InputDecoration( border: const OutlineInputBorder(), diff --git a/lib/fido/views/pin_dialog.dart b/lib/fido/views/pin_dialog.dart index 55fcc6af..fdf4b411 100755 --- a/lib/fido/views/pin_dialog.dart +++ b/lib/fido/views/pin_dialog.dart @@ -75,6 +75,7 @@ class _FidoPinDialogState extends ConsumerState { initialValue: _currentPin, autofocus: true, obscureText: true, + autofillHints: const [AutofillHints.password], decoration: InputDecoration( border: const OutlineInputBorder(), labelText: l10n.s_current_pin, @@ -96,6 +97,7 @@ class _FidoPinDialogState extends ConsumerState { initialValue: _newPin, autofocus: !hasPin, obscureText: true, + autofillHints: const [AutofillHints.password], decoration: InputDecoration( border: const OutlineInputBorder(), labelText: l10n.s_new_pin, @@ -114,6 +116,7 @@ class _FidoPinDialogState extends ConsumerState { TextFormField( initialValue: _confirmPin, obscureText: true, + autofillHints: const [AutofillHints.password], decoration: InputDecoration( border: const OutlineInputBorder(), labelText: l10n.s_confirm_pin, diff --git a/lib/oath/views/add_account_page.dart b/lib/oath/views/add_account_page.dart index 839a70ac..8d8da1c3 100755 --- a/lib/oath/views/add_account_page.dart +++ b/lib/oath/views/add_account_page.dart @@ -453,6 +453,7 @@ class _OathAddAccountPageState extends ConsumerState { key: keys.secretField, controller: _secretController, obscureText: _isObscure, + autofillHints: isAndroid ? [] : const [AutofillHints.password], inputFormatters: [ FilteringTextInputFormatter.allow( _secretFormatterPattern) diff --git a/lib/oath/views/manage_password_dialog.dart b/lib/oath/views/manage_password_dialog.dart index 5d2c50d2..3b95d5c2 100755 --- a/lib/oath/views/manage_password_dialog.dart +++ b/lib/oath/views/manage_password_dialog.dart @@ -82,6 +82,7 @@ class _ManagePasswordDialogState extends ConsumerState { TextField( autofocus: true, obscureText: true, + autofillHints: const [AutofillHints.password], key: keys.currentPasswordField, decoration: InputDecoration( border: const OutlineInputBorder(), @@ -141,6 +142,7 @@ class _ManagePasswordDialogState extends ConsumerState { key: keys.newPasswordField, autofocus: !widget.state.hasKey, obscureText: true, + autofillHints: const [AutofillHints.newPassword], decoration: InputDecoration( border: const OutlineInputBorder(), labelText: l10n.s_new_password, @@ -162,6 +164,7 @@ class _ManagePasswordDialogState extends ConsumerState { TextField( key: keys.confirmPasswordField, obscureText: true, + autofillHints: const [AutofillHints.newPassword], decoration: InputDecoration( border: const OutlineInputBorder(), labelText: l10n.s_confirm_password, diff --git a/lib/oath/views/unlock_form.dart b/lib/oath/views/unlock_form.dart index 2b04218e..a4cb3f74 100755 --- a/lib/oath/views/unlock_form.dart +++ b/lib/oath/views/unlock_form.dart @@ -77,6 +77,7 @@ class _UnlockFormState extends ConsumerState { controller: _passwordController, autofocus: true, obscureText: _isObscure, + autofillHints: const [AutofillHints.password], decoration: InputDecoration( border: const OutlineInputBorder(), labelText: l10n.s_password, From 55f2e6ed1a9476cfaded7db5ec107f5f1941ded8 Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Tue, 14 Mar 2023 17:12:20 +0100 Subject: [PATCH 2/2] add explaining comment for Android condition --- lib/oath/views/add_account_page.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/oath/views/add_account_page.dart b/lib/oath/views/add_account_page.dart index 8d8da1c3..1ce3c637 100755 --- a/lib/oath/views/add_account_page.dart +++ b/lib/oath/views/add_account_page.dart @@ -453,6 +453,8 @@ class _OathAddAccountPageState extends ConsumerState { key: keys.secretField, controller: _secretController, obscureText: _isObscure, + // avoid using autofill hints on Android otherwise Autofill service + // would hint to use saved passwords for this field autofillHints: isAndroid ? [] : const [AutofillHints.password], inputFormatters: [ FilteringTextInputFormatter.allow(