From 76883145fbb26051badfb77f73ca10450a1dadfb Mon Sep 17 00:00:00 2001 From: iglocska Date: Fri, 6 Nov 2020 09:21:44 +0100 Subject: [PATCH] chg: [user add] don't autocomplete username/password fields --- src/View/Helper/FormFieldMassageHelper.php | 3 +++ templates/Users/add.php | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/View/Helper/FormFieldMassageHelper.php b/src/View/Helper/FormFieldMassageHelper.php index 7d9fda1..183a9ed 100644 --- a/src/View/Helper/FormFieldMassageHelper.php +++ b/src/View/Helper/FormFieldMassageHelper.php @@ -13,6 +13,9 @@ class FormFieldMassageHelper extends Helper $controlParams['data-dependence-option'] = h($fieldData['stateDependence']['option']); } $controlParams['id'] = $fieldData['field'] . '-field'; + if (!empty($fieldData['autocomplete'])) { + $controlParams['autocomplete'] = $fieldData['autocomplete']; + } $formFieldElement = $form->control($fieldData['field'], $controlParams); if (!empty($fieldData['hidden'])) { $formFieldElement = ''; diff --git a/templates/Users/add.php b/templates/Users/add.php index 73b430a..99bf366 100644 --- a/templates/Users/add.php +++ b/templates/Users/add.php @@ -11,19 +11,22 @@ 'options' => $dropdownData['individual'] ], [ - 'field' => 'username' + 'field' => 'username', + 'autocomplete' => 'off' ], [ 'field' => 'password', 'label' => __('Password'), 'type' => 'password', - 'required' => $this->request->getParam('action') === 'add' ? 'required' : false + 'required' => $this->request->getParam('action') === 'add' ? 'required' : false, + 'autocomplete' => 'new-password' ], [ 'field' => 'confirm_password', 'label' => __('Confirm Password'), 'type' => 'password', - 'required' => $this->request->getParam('action') === 'add' ? 'required' : false + 'required' => $this->request->getParam('action') === 'add' ? 'required' : false, + 'autocomplete' => 'off' ], [ 'field' => 'role_id',