Arreglos login y recuperar contraseña

This commit is contained in:
imnavajas
2023-05-15 15:15:52 +02:00
parent efceab14d4
commit ea0c714550
7 changed files with 105 additions and 104 deletions

48
.idea/workspace.xml generated
View File

@ -6,21 +6,12 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7c8f7059-cd40-417c-936e-48dbc0507d86" name="Changes" comment="Add static Vuexy files"> <list default="true" id="7c8f7059-cd40-417c-936e-48dbc0507d86" name="Changes" comment="Add static Vuexy files">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/.env" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/.env" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ci4/app/Config/Boot/development.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Config/Boot/development.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Config/Basics.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Config/Basics.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ci4/app/Config/Routes.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Config/Routes.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/GoBaseController.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/GoBaseController.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Integration.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Integration.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Home.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Home.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Login.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Login.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Tarifas/Tarifaacabado.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Tarifas/Tarifaacabado.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ci4/app/Helpers/general_helper.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Helpers/general_helper.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Controllers/Test.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Controllers/Test.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Language/en/App.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Language/en/App.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Language/es/App.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Language/es/App.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ci4/app/Language/es/App.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Language/es/App.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Language/es/Tarifaaacabado.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Language/es/Tarifaacabado.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/_commonPartialsBs/datatables.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/_commonPartialsBs/datatables.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/login/header.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/login/header.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/all.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/all.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/crud_layout.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/crud_layout.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/header.php" beforeDir="false" afterPath="$PROJECT_DIR$/ci4/app/Views/themes/backend/vuexy/main/header.php" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -42,20 +33,20 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"RunOnceActivity.OpenProjectViewOnStart": "true", &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"WebServerToolWindowFactoryState": "false", &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
"last_opened_file_path": "C:/temp-sk/safekat/ci4/app/Views/themes/backend/vuexy/main", &quot;last_opened_file_path&quot;: &quot;C:/temp-sk/safekat/ci4/app/Views/themes/backend/vuexy/main&quot;,
"node.js.detected.package.eslint": "true", &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
"node.js.detected.package.tslint": "true", &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
"node.js.selected.package.eslint": "(autodetect)", &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
"node.js.selected.package.tslint": "(autodetect)", &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
"nodejs_package_manager_path": "npm", &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
"vue.rearranger.settings.migration": "true" &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
} }
}]]></component> }</component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="C:\temp-sk\safekat\ci4\app\Views\themes\backend\vuexy\main" /> <recent name="C:\temp-sk\safekat\ci4\app\Views\themes\backend\vuexy\main" />
@ -85,7 +76,8 @@
<workItem from="1683619057531" duration="16014000" /> <workItem from="1683619057531" duration="16014000" />
<workItem from="1683715799575" duration="151000" /> <workItem from="1683715799575" duration="151000" />
<workItem from="1683716769681" duration="8512000" /> <workItem from="1683716769681" duration="8512000" />
<workItem from="1683796910193" duration="12574000" /> <workItem from="1683796910193" duration="12918000" />
<workItem from="1684147458134" duration="7379000" />
</task> </task>
<task id="LOCAL-00001" summary="Starting Vuexy Theme creation"> <task id="LOCAL-00001" summary="Starting Vuexy Theme creation">
<created>1682339938559</created> <created>1682339938559</created>

View File

@ -29,4 +29,4 @@ defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
| the system. This will control whether Kint is loaded, and a few other | the system. This will control whether Kint is loaded, and a few other
| items. It can always be used within your own application too. | items. It can always be used within your own application too.
*/ */
defined('CI_DEBUG') || define('CI_DEBUG', true); defined('CI_DEBUG') || define('CI_DEBUG', false); // IMN Changed for deleting DEBUG VIEW MSGs

View File

@ -82,10 +82,6 @@ $routes->group('', [], function($routes) {
}); });
}); });

View File

@ -131,23 +131,23 @@ class Integration extends BaseController
foreach (keywordEmail()??[] as $item){ foreach (keywordEmail()??[] as $item){
$field = str_replace(['[','user_',']'],'',$item); $field = str_replace(['[','user_',']'],'',$item);
$template = str_replace('['.$item.']',$user[$field],$template); $template = str_replace('['.$item.']',$user->$field ?? "",$template);
} }
$token = random_string("alnum", 50); $token = random_string("alnum", 50);
$url = base_url().'/login/recovery/'.$token; $url = base_url().'login/recovery/'.$token;
$this->pass_recovery_model->save([ $this->pass_recovery_model->save([
'user' => $user['token'], 'user' => $user->token,
'token' => $token 'token' => $token
]); ]);
$title = $template['subject']??''; $title = $template['subject']??'';
$msg = $template['body']??''; $msg = $template['body']??'';
$msg = str_replace('[recovery_password]',$url,$msg); $msg = str_replace('[recovery_password]',$url,$msg);
$email = $user['email']; $email = $user->email;
$this->setLog('recovery','recovery-password',$user['token']); $this->setLog('recovery','recovery-password',$user->token);
$send = $this->sendMail($title,$msg,$email); $send = $this->sendMail($title,$msg,$email);
if($send){ if($send){
$session->setFlashdata('toast', ['success',lang("App.login_alert_send"),lang("App.login_alert_send_pass")]); $session->setFlashdata('toast', ['success',lang("App.login_alert_send"),lang("App.login_alert_send_pass")]);

View File

@ -509,6 +509,7 @@ class login extends BaseController
$session = session(); $session = session();
if(!empty($token) && $session->get('settings')['forgot_password']??false){ if(!empty($token) && $session->get('settings')['forgot_password']??false){
$pass_recovery = $this->pass_recovery_model->where('token',$token)->where('changed',false)->first(); $pass_recovery = $this->pass_recovery_model->where('token',$token)->where('changed',false)->first();
if($pass_recovery != null){ if($pass_recovery != null){
$data['token'] = $token; $data['token'] = $token;
$data['user'] = $pass_recovery['user']; $data['user'] = $pass_recovery['user'];
@ -551,7 +552,7 @@ class login extends BaseController
if($user != null){ if($user != null){
$phpass = new PasswordHash(8, true); $phpass = new PasswordHash(8, true);
$this->user_model->save([ $this->user_model->save([
'id_user' => $user['id_user'], 'id_user' => $user->id_user,
'password' => $phpass->HashPassword($listPost['password']) 'password' => $phpass->HashPassword($listPost['password'])
]); ]);
$this->pass_recovery_model->save([ $this->pass_recovery_model->save([

View File

@ -298,16 +298,28 @@ function getArrayItem(array $array, $key, $word, $isArray=false)
/// Notification Messages /// Notification Messages
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// IMN Modified
function formAlert() function formAlert()
{ {
$session = session(); $session = session();
$alert = $session->getFlashdata('error'); $alert = $session->getFlashdata('error');
$validation = \Config\Services::validation()->listErrors();
if (!empty($alert)){ if (!empty($alert)){
return '<div class="alert alert-danger alert-dismissible alert-alt solid fade show">'.
' <button type="button" class="close h-100" data-dismiss="alert" aria-label="Close"><span><i class="mdi mdi-close"></i></span>'. $validations = \Config\Services::validation()->getErrors();
' </button>'. $validation . $alerts = "";
foreach ($validations as $key => $value){
$alerts .= '<div class="alert alert-danger alert-dismissible" role="alert">'.
' ' . $value .
' <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">'.
' </button>'.
'</div>'; '</div>';
}
return $alerts;
} }
} }

View File

@ -38,8 +38,8 @@ return [
"login_password_ph" => "Escribe tu contraseña", "login_password_ph" => "Escribe tu contraseña",
"login_remember_me" => "Recuérdame", "login_remember_me" => "Recuérdame",
"login_forgot_password" => "Olvidé la contraseña", "login_forgot_password" => "Olvidé la contraseña",
"login_access" => "Registrarse", "login_access" => "Acceder",
"login_signup" => "Inscribirse", "login_signup" => "Registrar",
"login_signup_desc" => "¿Aún no tienes una cuenta?", "login_signup_desc" => "¿Aún no tienes una cuenta?",
// LOGIN - forgot_password // LOGIN - forgot_password
@ -69,7 +69,7 @@ return [
"login_terms_use" => "Condiciones de uso", "login_terms_use" => "Condiciones de uso",
"login_accept" => "Aceptada", "login_accept" => "Aceptada",
"login_closed" => "Cerrada", "login_closed" => "Cerrada",
"login_register" => "Registrarse", "login_register" => "Acceder",
// LOGIN - notification // LOGIN - notification
"login_alert" => "¡Atención!", "login_alert" => "¡Atención!",