Arreglado el inscribir un nuevo usuario

This commit is contained in:
Jaime Jimenez
2023-07-15 12:09:27 +02:00
parent 4af11ec3e2
commit 2fca432213
7 changed files with 55 additions and 35 deletions

View File

@ -50,9 +50,12 @@ class Integration extends BaseController
if(!empty($user)){
foreach (keywordEmail()??[] as $item){
$field = str_replace(['[','user_',']'],'',$item);
$body = str_replace('['.$item.']',$user[$field],$body);
if(str_contains($body, $field)){
$body = str_replace('['.$item.']',$user->{$field},$body);
}
}
}
if($this->sendMail($subject,unescape($body),$email)){
return $json ? json_encode(["return" => true]) : true;
}else{

View File

@ -365,7 +365,7 @@ class login extends BaseController
$rules = [
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|valid_email|is_unique[user.email]',
'email' => 'required|valid_email|is_unique[auth_user.email]',
'password' => 'required|min_length[8]'
];
$rules_error = [
@ -385,9 +385,10 @@ class login extends BaseController
'min_length' => lang("App.login_rules_password_m")
]
];
if ($this->validate($rules,$rules_error)){
if($listPost = $this->request->getPost()) {
if($settings['captcha_register']??false){
if($settings['captcha_gateway'] == 'recaptcha'){
if(isset($listPost['g-recaptcha-response'])){
@ -426,8 +427,8 @@ class login extends BaseController
}
$phpass = new PasswordHash(8, true);
$userToken = md5(uniqid(rand(), true));
$this->user_model->save([
'group' => $settings['default_role'],
$this->user_model->skipValidation(true)->save([
//'group' => $settings['default_role'],
'first_name' => $listPost['first_name'],
'last_name' => $listPost['last_name'],
'mobile' => '',
@ -438,7 +439,12 @@ class login extends BaseController
'last_ip' => '::1',
'language' => $settings['default_language'],
'token' => $userToken,
'status' => true
'status' => 1,
'address' => '',
'city' => '',
'state' => '',
'country' => '',
'zip_code' => '',
]);
//Get Data Template
$templates = $this->template_model->findAll();
@ -450,6 +456,7 @@ class login extends BaseController
try {
$this->integration->send_email($listPost['email'],$template['subject'],$template['body'],$phpass->HashPassword(MD5($listPost['email'])));
}catch (\Exception $e){
}
}
}

View File

@ -11,8 +11,8 @@ class Maquina extends \CodeIgniter\Entity\Entity
"is_padre" => false,
"tipo" => null,
"velocidad" => 0.0,
"ancho" => null,
"alto" => null,
"ancho" => 100.0,
"alto" => 100.0,
"ancho_impresion" => 0.0,
"alto_impresion" => 0.0,
"alto_click" => 0.0,
@ -27,10 +27,10 @@ class Maquina extends \CodeIgniter\Entity\Entity
"precio_tinta_color" => 0.0,
"velocidad_corte" => 0.0,
"precio_hora_corte" => 0.0,
"metrosxminuto" => null,
"metrosxminuto" => 0.0,
"forzar_num_formas_horizontales_portada" => null,
"forzar_num_formas_verticales_portada" => null,
"observaciones" => null,
"observaciones" => "",
"is_deleted" => 0,
"created_at" => null,
"updated_at" => null,

View File

@ -7,15 +7,14 @@ class UserEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id_user" => null,
"group" => null,
"first_name" => null,
"last_name" => null,
"date_birth" => null,
"address" => null,
"city" => null,
"state" => null,
"country" => null,
"zip_code" => null,
"address" => "",
"city" => "",
"state" => "",
"country" => "",
"zip_code" => "",
"mobile" => null,
"email" => null,
"password" => null,
@ -24,8 +23,8 @@ class UserEntity extends \CodeIgniter\Entity\Entity
"picture" => "/assets/img/default-user.png",
"language" => null,
"tfa" => false,
"tfa_secret" => null,
"tfa_code" => null,
"tfa_secret" => "",
"tfa_code" => "",
"blocked" => null,
"email_confirmed" => 0,
"token" => null,

View File

@ -199,7 +199,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
],
"observaciones" => [
"max_length" => "Maquinas.validation.observaciones.max_length",
"required" => "Maquinas.validation.observaciones.required",
//"required" => "Maquinas.validation.observaciones.required",
],
"orden_planning" => [
"integer" => "Maquinas.validation.orden_planning.integer",

View File

@ -8,7 +8,7 @@
<label for="nombre" class="form-label">
<?=lang('Maquinas.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $maquina->nombre) ?>">
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?=old('nombre', $maquina->nombre) ?>">
</div><!--//.col -->
</div><!--//.mb-3 -->
@ -17,7 +17,7 @@
<label for="min" class="form-label">
<?=lang('Maquinas.min') ?>*
</label>
<input type="number" id="min" name="min" required placeholder="1" maxLength="11" class="form-control" value="<?=old('min', $maquina->min) ?>">
<input type="number" id="min" name="min" placeholder="1" maxLength="11" class="form-control" value="<?=old('min', $maquina->min) ?>">
</div>
</div><!--//.col -->
@ -26,7 +26,7 @@
<label for="max" class="form-label">
<?=lang('Maquinas.max') ?>*
</label>
<input type="number" id="max" name="max" required placeholder="1000000" maxLength="11" class="form-control" value="<?=old('max', $maquina->max) ?>">
<input type="number" id="max" name="max" placeholder="1000000" maxLength="11" class="form-control" value="<?=old('max', $maquina->max) ?>">
</div>
</div><!--//.col -->
@ -35,7 +35,7 @@
<label for="velocidad" class="form-label">
<?=lang('Maquinas.velocidad') ?>*
</label>
<input type="number" id="velocidad" name="velocidad" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('velocidad', $maquina->velocidad) ?>">
<input type="number" id="velocidad" name="velocidad" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('velocidad', $maquina->velocidad) ?>">
</div>
</div><!--//.col -->
@ -44,7 +44,7 @@
<label for="tipo" class="form-label">
<?=lang('Maquinas.tipo') ?>*
</label>
<select id="tipo" name="tipo" required class="form-control select2bs" style="width: 100%;" >
<select id="tipo" name="tipo" class="form-control select2bs" style="width: 100%;" >
<option value="" selected="selected"><?=lang('Basic.global.pleaseSelectOne') ?></option>
<option value="impresion"<?=$maquina->tipo == 'impresion' ? ' selected':'' ?>><?= lang('Maquinas.impresion') ?></option>
<option value="manipulado"<?=$maquina->tipo == 'manipulado' ? ' selected':'' ?>><?= lang('Maquinas.manipulado') ?></option>
@ -63,7 +63,7 @@
<label for="ancho" class="form-label">
<?=lang('Maquinas.ancho') ?>*
</label>
<input type="number" id="ancho" name="ancho" maxLength="8" step="0.01" class="form-control" value="<?=old('ancho', $maquina->ancho) ?>">
<input type="number" id="ancho" name="ancho" placeholder="100.0" maxLength="8" step="0.01" class="form-control" value="<?=old('ancho', $maquina->ancho) ?>">
</div>
</div><!--//.col -->
@ -72,7 +72,7 @@
<label for="alto" class="form-label">
<?=lang('Maquinas.alto') ?>*
</label>
<input type="number" id="alto" name="alto" maxLength="8" step="0.01" class="form-control" value="<?=old('alto', $maquina->alto) ?>">
<input type="number" id="alto" name="alto" placeholder="100.0" maxLength="8" step="0.01" class="form-control" value="<?=old('alto', $maquina->alto) ?>">
</div>
</div><!--//.col -->
@ -81,7 +81,7 @@
<label for="anchoImpresion" class="form-label">
<?=lang('Maquinas.anchoImpresion') ?>*
</label>
<input type="number" id="anchoImpresion" name="ancho_impresion" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('ancho_impresion', $maquina->ancho_impresion) ?>">
<input type="number" id="anchoImpresion" name="ancho_impresion" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('ancho_impresion', $maquina->ancho_impresion) ?>">
</div>
</div><!--//.col -->
@ -90,7 +90,7 @@
<label for="altoImpresion" class="form-label">
<?=lang('Maquinas.altoImpresion') ?>*
</label>
<input type="number" id="altoImpresion" name="alto_impresion" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('alto_impresion', $maquina->alto_impresion) ?>">
<input type="number" id="altoImpresion" name="alto_impresion" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('alto_impresion', $maquina->alto_impresion) ?>">
</div>
</div><!--//.col -->
@ -99,7 +99,7 @@
<label for="altoClick" class="form-label">
<?=lang('Maquinas.altoClick') ?>*
</label>
<input type="number" id="altoClick" name="alto_click" required placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('alto_click', $maquina->alto_click) ?>">
<input type="number" id="altoClick" name="alto_click" placeholder="0.00" maxLength="8" step="0.01" class="form-control" value="<?=old('alto_click', $maquina->alto_click) ?>">
</div>
</div><!--//.col -->
@ -114,7 +114,7 @@
<label for="duracionJornada" class="form-label" >
<?=lang('Maquinas.duracionJornada') ?>*
</label>
<input type="number" id="duracionJornada" name="duracion_jornada" required placeholder="8" maxLength="11" class="form-control" value="<?=old('duracion_jornada', $maquina->duracion_jornada) ?>">
<input type="number" id="duracionJornada" name="duracion_jornada" placeholder="8" maxLength="11" class="form-control" value="<?=old('duracion_jornada', $maquina->duracion_jornada) ?>">
</div>
</div><!--//.col -->
@ -123,7 +123,7 @@
<label for="ordenPlanning" class="form-label">
<?=lang('Maquinas.ordenPlanning') ?>*
</label>
<input type="number" id="ordenPlanning" name="orden_planning" required placeholder="1" maxLength="11" class="form-control" value="<?=old('orden_planning', $maquina->orden_planning) ?>">
<input type="number" id="ordenPlanning" name="orden_planning" placeholder="1" maxLength="11" class="form-control" value="<?=old('orden_planning', $maquina->orden_planning) ?>">
</div>
</div><!--//.col -->

View File

@ -43,13 +43,24 @@
<form id="sendForm" class="mb-3" action="<?=site_url("login/store")?>" method="POST">
<?= csrf_field() ?>
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<label for="first_name" class="form-label"><?= lang("App.login_first_name") ?></label>
<input
type="text"
class="form-control"
id="username"
name="username"
placeholder="Enter your username"
id="first_name"
name="first_name"
placeholder=<?= lang("App.login_first_name_ph") ?>
autofocus
/>
</div>
<div class="mb-3">
<label for="last_name" class="form-label"><?= lang("App.login_last_name") ?></label>
<input
type="text"
class="form-control"
id="last_name"
name="last_name"
placeholder=<?= lang("App.login_last_name_ph") ?>
autofocus
/>
</div>