Añadido campo de verficacion de contraseña y campo de notas

This commit is contained in:
imnavajas
2024-07-16 22:52:05 +02:00
parent 57688a5310
commit 0b6ce06c96
5 changed files with 150 additions and 108 deletions

View File

@ -53,15 +53,12 @@ class Users extends \App\Controllers\GoBaseController
public function index()
{
$this->viewData['usingClientSideDataTable'] = true;
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Users.user')]);
$this->viewData['user_model'] = $this->user_model;
$this->viewData['userList2'] = auth()->getProvider()->findAll();
parent::index();
}
public function add()
@ -72,21 +69,24 @@ class Users extends \App\Controllers\GoBaseController
$postData = $this->request->getPost();
// Obtener contraseña nueva si se ha introducido en texto plano
if (empty($postData['password'])) {
if (empty($postData['new_pwd'])) {
$postData['password'] = 'Safekat2024'; // Contraseña por defecto
}else{
$postData['password'] = $postData['new_pwd'];
}
// Obtener los grupos a los que pertenece
$currentGroups = $postData['group'] ?? [];
unset($postData['group']);
// Generar el nombre de usuario
$postData['username'] = strstr($postData['email'], '@', true);
$sanitizedData = $this->sanitized($postData, true);
$noException = true;
// Obtener proveedor de usuarios
$users = auth()->getProvider();
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($successfulResult = $this->canValidate()) :
if ($this->canValidate()) :
try {
@ -179,8 +179,9 @@ class Users extends \App\Controllers\GoBaseController
unset($postData['group']);
// Obtener contraseña nueva si se ha introducido en texto plano
if (empty($postData['password'])) {
unset($postData['password']);
// Obtener contraseña nueva si se ha introducido en texto plano
if (!empty($postData['new_pwd'])) {
$postData['password'] = $postData['new_pwd'];
}
$sanitizedData = $this->sanitized($postData, true);