From 3d0fdeba81cacde04aa9d55a1a4e326ce04a46c5 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Tue, 1 Mar 2022 13:59:10 +0100 Subject: [PATCH] fix: [users:add] Decoupled password required and visibility --- templates/Users/add.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/Users/add.php b/templates/Users/add.php index 1f68ae5..c6999dc 100644 --- a/templates/Users/add.php +++ b/templates/Users/add.php @@ -1,12 +1,16 @@ request->getParam('action') === 'add') { $dropdownData['individual'] = ['new' => __('New individual')] + $dropdownData['individual']; if (!Configure::check('password_auth.enabled') || Configure::read('password_auth.enabled')) { $passwordRequired = 'required'; } } + if (!Configure::check('password_auth.enabled') || Configure::read('password_auth.enabled')) { + $showPasswordField = true; + } echo $this->element('genericElements/Form/genericForm', [ 'data' => [ 'description' => __('Roles define global rules for a set of users, including first and foremost access controls to certain functionalities.'), @@ -62,7 +66,7 @@ 'required' => $passwordRequired, 'autocomplete' => 'new-password', 'value' => '', - 'requirements' => (bool)$passwordRequired + 'requirements' => $showPasswordField, ], [ 'field' => 'confirm_password', @@ -70,7 +74,7 @@ 'type' => 'password', 'required' => $passwordRequired, 'autocomplete' => 'off', - 'requirements' => (bool)$passwordRequired + 'requirements' => $showPasswordField, ], [ 'field' => 'role_id',