fix: [users:add] Decoupled password required and visibility
parent
b91f4b5d01
commit
3d0fdeba81
|
@ -1,12 +1,16 @@
|
|||
<?php
|
||||
use Cake\Core\Configure;
|
||||
$passwordRequired = false;
|
||||
$showPasswordField = false;
|
||||
if ($this->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',
|
||||
|
|
Loading…
Reference in New Issue