Data flow login fix

This commit is contained in:
CHIEFSOFT\ameye
2025-06-14 07:05:26 -04:00
parent d7750b95de
commit 48ffd73884
3 changed files with 62 additions and 51 deletions
+2 -1
View File
@@ -11,4 +11,5 @@ $arr["port"] = 5432;
define('LEGACY_BACKEND_ENDPOINT','backend.wrenchboard.api.live');
//define('EXTENSTION_API_URL','https://dashboard.wrenchboard.com/svs/bko'); //
// define('EXTENSTION_API_URL','http://172.16.4.100:9083/svs/bko');
define('EXTENSTION_API_URL','http://172.16.4.25:9083/svs/bko');
//define('EXTENSTION_API_URL','http://172.16.4.25:9083/svs/bko');
define('EXTENSTION_API_URL','http://172.16.4.25:9083/backoffice/svs/bko');
+3 -1
View File
@@ -47,6 +47,8 @@ class Bko extends CI_Controller {
*/
$this->populate_bko_session($res, $out);
redirect('bkouser/dash');
exit();
}
}
@@ -64,7 +66,7 @@ class Bko extends CI_Controller {
$_SESSION['bko_selected_memberd_id'] = 0;
$_SESSION['bko_group'] = $out['group_id'];
$_SESSION['bkodata'] = $out;
redirect('bkouser/dash');
}
}
+57 -49
View File
@@ -14,67 +14,75 @@ class Login extends WRB_Controller {
public function index() {
$data["login_message"] = "";
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() !== false) {
try {
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() !== false) {
$data['username'] = strtolower($this->input->post('username')); // '08174596144';
$data['password'] = $this->input->post('password'); //'7978';
$data['username'] = strtolower($this->input->post('username')); // '08174596144';
$data['password'] = $this->input->post('password'); //'7978';
$data['sessionid'] = rand(10000, 99999) . "A" . rand(10000, 99999);
$data['action'] = WRENCHBOARD_ACCOUNT_LOGIN;
$this->load->model('backend_model');
$out = array();
// $res = $this->backend_model->wrenchboard_api($data, $out);
$res = $this->wrenchboard_api($data, $out);
$is_live = $this->backend_model->cfgReadChar("system.live");
$data['sessionid'] = rand(10000, 99999) . "A" . rand(10000, 99999);
$data['action'] = WRENCHBOARD_ACCOUNT_LOGIN;
$this->load->model('backend_model');
$out = array();
// $res = $this->backend_model->wrenchboard_api($data, $out);
$res = $this->wrenchboard_api($data, $out);
$is_live = $this->backend_model->cfgReadChar("system.live");
// var_dump($out);
// print_r($out);
if ($res == PHP_LOGIN_OK) {
$this->load->model('account_model');
$ret = $this->account_model->username_data($data);
if ($res !== false) {
$data["login_message"] = "Welcome...";
// yes person has an account
$_SESSION['session_id'] = $out["session"];
$_SESSION['username'] = $this->input->post('username');
$_SESSION['name'] = $this->input->post('username');
$_SESSION['firstname'] = $ret->firstname;
$_SESSION['lastname'] = $ret->lastname;
$_SESSION['email'] = $ret->email;
$_SESSION['member_id'] = $ret->id;
$_SESSION['log_count'] = 0;
$_SESSION['mesaage_count'] = 0;
$this->findOffers($_SESSION['email']);
$_SESSION['message_snapshot'] = $this->myMessagesSnapshot();
$_SESSION['total_jobs'] = 0;
if (trim($ret->profile_pic) == '') {
// Show default picture
$_SESSION['profile_picture'] = "../smedia/DEFAULTS/default-profile.png";
} else {
// show the profile picture
$_SESSION['profile_picture'] = "../smedia/" . ($is_live ? "LIVE" : "TEST") . "/profile/" . $ret->profile_pic;
// print_r($out);
if ($res == PHP_LOGIN_OK) {
$this->load->model('account_model');
$ret = $this->account_model->username_data($data);
if ($res !== false) {
$data["login_message"] = "Welcome...";
// yes person has an account
$_SESSION['session_id'] = $out["session"];
$_SESSION['username'] = $this->input->post('username');
$_SESSION['name'] = $this->input->post('username');
$_SESSION['firstname'] = $ret->firstname;
$_SESSION['lastname'] = $ret->lastname;
$_SESSION['email'] = $ret->email;
$_SESSION['member_id'] = $ret->id;
$_SESSION['log_count'] = 0;
$_SESSION['mesaage_count'] = 0;
$this->findOffers($_SESSION['email']);
$_SESSION['message_snapshot'] = $this->myMessagesSnapshot();
$_SESSION['total_jobs'] = 0;
if (trim($ret->profile_pic) == '') {
// Show default picture
$_SESSION['profile_picture'] = "../smedia/DEFAULTS/default-profile.png";
} else {
// show the profile picture
$_SESSION['profile_picture'] = "../smedia/" . ($is_live ? "LIVE" : "TEST") . "/profile/" . $ret->profile_pic;
}
$this->logUser('Account login');
$this->refreshAccountDetail($_SESSION['member_id']);
$this->getSessionArray();
redirect('dash');
}
$this->logUser('Account login');
$this->refreshAccountDetail($_SESSION['member_id']);
$this->getSessionArray();
redirect('dash');
} else {
$data["login_message"] = "Invalid username or password";
}
$res = false; // $this->login_model->verify_login($data);
} else {
$data["login_message"] = "Invalid username or password";
echo validation_errors();
}
$res = false; // $this->login_model->verify_login($data);
} else {
echo validation_errors();
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
if ($this->lib_login->is_authenticated()) {