Auto Login Code : ps
This commit is contained in:
parent
996daa9285
commit
378a19da9b
@ -1759,19 +1759,49 @@ public function filterSalesPDList_post() {
|
||||
* TO Trigger New Sales PD and Inserting the applicant on general Form also.
|
||||
****** ******/
|
||||
public function cetNewSalesPd_get(){
|
||||
$saltkey = $this->get('saltkey');
|
||||
// $hash = password_hash("Smc@123$", PASSWORD_DEFAULT);
|
||||
// Print the generated hash
|
||||
// echo "Generated hash: ".$hash;die;
|
||||
// MwiseSales@yahoo.com#sine1234
|
||||
// $2y$10$n4dEVCXJ2Oho9KJUnhss/.LAXTyXN60dz332ZRPNp4VpY8J.Ue7ly
|
||||
if($saltkey != ''){
|
||||
log_message('ERROR','## A) saltkey Found : '.$saltkey);
|
||||
if(password_verify("Smc@123$", $saltkey)){
|
||||
log_message('ERROR','## B) toMakeCetNewSalesPd Fns Going to Call');
|
||||
$this->toMakeCetNewSalesPd($this->get());
|
||||
}else{
|
||||
log_message('ERROR','## B) Invaild Salt key ');
|
||||
$response['status']=false;
|
||||
$response['error']="Access denied ! Invaild Salt key";
|
||||
$this->response($response,REST_Controller::HTTP_UNAUTHORIZED);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else{
|
||||
log_message('ERROR','## A) saltkey Not Found : '.$saltkey);
|
||||
$response['status']=false;
|
||||
$response['error']="Access denied ! Salt key Not Found!";
|
||||
$this->response($response,REST_Controller::HTTP_UNAUTHORIZED);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public function toMakeCetNewSalesPd($array){
|
||||
// print_r($array['type']);die;
|
||||
// header("Location: https://demo.pdgenie.com/salespdpwa/#/sales-pd-list/list-pd");
|
||||
log_message('ERROR','## In NewSalesPd');
|
||||
$sales_pd_type = $this->get('type');
|
||||
$productname = $this->get('product');
|
||||
$applicantname = $this->get('applicantname');
|
||||
$applicantid = $this->get('applicantid');
|
||||
$userid = $this->get('uid');
|
||||
$loanamount = $this->get('loan_amount');
|
||||
log_message('ERROR','## C) Inside toMakeCetNewSalesPd Fns');
|
||||
$sales_pd_type = $array['type'];
|
||||
$productname = $array['product'];
|
||||
$applicantname = $array['applicantname'];
|
||||
$applicantid = $array['applicantid'];
|
||||
$usersemailid = $array['userid'];
|
||||
$loanamount = $array['loanamount'];
|
||||
$createdby = null;
|
||||
// $reponse_arr = json_decode(,true);
|
||||
// print_r(APPPATH."controller/newSalesPD.json");die();
|
||||
$lenderid = (ENVIRONMENT == 'production' ? 7 : 35);
|
||||
if ((!empty($sales_pd_type)) && (!empty($productname)) && (!empty($applicantname)) && (!empty($applicantid)) && (!empty($userid)) && (!empty($loanamount))) {
|
||||
if ((!empty($sales_pd_type)) && (!empty($productname)) && (!empty($applicantname)) && (!empty($applicantid)) && (!empty($usersemailid)) && (!empty($loanamount))) {
|
||||
|
||||
/************lender id,shortname******************/
|
||||
$lender_short_name = $this->Sales_PD_Model->selectCustomRecords(array('short_name'),array('entity_id' => $lenderid),ENTITY);
|
||||
@ -1780,7 +1810,7 @@ public function filterSalesPDList_post() {
|
||||
if($productname){
|
||||
$product_short_name = preg_replace('/[^A-Za-z0-9\-]/', '', strtoupper($productname));
|
||||
$product_where_condition = array('isactive' => 1);
|
||||
if ($userid) {
|
||||
if ($usersemailid) {
|
||||
$product_where_condition['abbr like'] = '%'.$product_short_name.'%';
|
||||
}
|
||||
|
||||
@ -1789,16 +1819,22 @@ public function filterSalesPDList_post() {
|
||||
}
|
||||
|
||||
/************user id******************/
|
||||
$user_fields = array('userid');
|
||||
$user_where_condition = array('isactive' => 1);
|
||||
// $userid = preg_replace('/[^A-Za-z0-9\/_|+ .-]/', '', $userid);
|
||||
if ($userid) {
|
||||
$user_where_condition['email like'] = '%'.$userid.'%';
|
||||
$columns = array('USERPROFILE.userid','ROLES.role_id','USERPROFILEROLES.user_role','ROLES.role_name');
|
||||
$table = USERPROFILE.' as USERPROFILE';
|
||||
$joins = array(array('table' => USERPROFILEROLES. ' as USERPROFILEROLES',
|
||||
'condition' =>'USERPROFILEROLES.fk_userid = USERPROFILE.userid and USERPROFILEROLES.isactive =1',
|
||||
'jointype' => 'INNER'),
|
||||
array('table' => ROLES.' as ROLES',
|
||||
'condition' =>'ROLES.role_id = USERPROFILEROLES.user_role',
|
||||
'jointype' => 'INNER'));
|
||||
$order_by = 'USERPROFILE.userid';
|
||||
if ($usersemailid) {
|
||||
$user_where_condition['email like'] = '%'.$usersemailid.'%';
|
||||
}
|
||||
$user_id = $this->Sales_PD_Model->selectCustomRecords($user_fields, $user_where_condition, USERPROFILE);
|
||||
|
||||
// print_r($this->db->last_query());die();
|
||||
$createdby = $user_id[0]['userid'];
|
||||
$user_details = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$user_where_condition,$order_by,'DESC','',$or_where);
|
||||
$user_id = $user_details[0]['userid'];
|
||||
$role_id = $user_details[0]['role_id'];
|
||||
$createdby = $user_id;
|
||||
|
||||
/************random URL******************/
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-';
|
||||
@ -1825,7 +1861,7 @@ public function filterSalesPDList_post() {
|
||||
$msg = "Inserted, Sales PD : ".$salepd_serial_no."/".$id;
|
||||
$template = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('lender_id' => $lenderid,'product_id' => $product_id,'pd_type' => 1,'sales_pd_type' => $sales_pd_type,'isactive' => 1),SALESPDTEMPLATE);
|
||||
log_message('ERROR',"## 3) sales_pd_template_id : ".$template[0]["sales_pd_template_id"]." name : ".$template[0]["name"]." lender_id : ".$template[0]["lender_id"]." product_id : ".$template[0]["product_id"]." pd_type : ".$template[0]["pd_type"]." sales_pd_type : ".$template[0]["sales_pd_type"]);
|
||||
log_message('ERROR','## 4) msg : '.$msg);
|
||||
log_message('ERROR','## 4) '.$msg);
|
||||
$template = json_decode($template[0]['template'],true);
|
||||
$section_data=array();
|
||||
foreach ($template['sections'] as $key => $value){
|
||||
@ -1903,8 +1939,9 @@ public function filterSalesPDList_post() {
|
||||
$section_data_arr = json_encode($data_value);
|
||||
$fields = array('sales_pd_id' => $id, 'section_id' => $data_value['section_id'], 'status' =>1,'section_data' => $section_data_arr,'createdby' => $createdby);
|
||||
$reponse = $this->Sales_PD_Model->saveRecords($fields,SALESPD_SECTION_DATA);
|
||||
// $reponse = 1;
|
||||
$msg = $msg." ( ".$data_value['section_name']." ID : ".$reponse. " )";
|
||||
log_message('ERROR','## 5) msg : '.$msg);
|
||||
log_message('ERROR','## 5) Confirmation : '.$msg);
|
||||
}
|
||||
}
|
||||
$data['dataStatus'] = true;
|
||||
@ -1920,7 +1957,25 @@ public function filterSalesPDList_post() {
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'Param (or) Value Not Missing,Please Check again';
|
||||
}
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
log_message('ERROR','## 6) Finally, '.$data['msg']);
|
||||
if(ENVIRONMENT == 'production'){
|
||||
$auth_user_id = "MwiseSales@yahoo.com";
|
||||
$auth_password = "sine1234";
|
||||
$token = base64_encode($auth_user_id."#".$auth_password."#".$user_id."#".$role_id);
|
||||
// echo $token;
|
||||
// log_message('ERROR','## 7) Finally, '.$data['msg']);
|
||||
$redirect_uri = "https://pdgenie.com/sales/#/auto?token=".$token; // For Production
|
||||
}else{
|
||||
$auth_user_id = "MwiseSales@yahoo.com";
|
||||
$auth_password = "sine1234";
|
||||
$token = base64_encode($auth_user_id."#".$auth_password."#".$user_id."#".$role_id);
|
||||
// echo $token;
|
||||
// $token = base64_encode('mwisesales1@sine.com#test1234'."#".$user_id."#".$role_id);
|
||||
// $redirect_uri = "http://localhost:4200/#/auto?token=".$token; // For Localhost
|
||||
$redirect_uri ="https://demo.pdgenie.com/salespdpwa/#/auto?token=".$token; // For Testing
|
||||
}
|
||||
header("Location: ".$redirect_uri);
|
||||
// $this->response($data,REST_Controller::HTTP_OK);
|
||||
//if($data['dataStatus']){ header("Location: https://sidharthindustries.com/SIA/"); }
|
||||
|
||||
}
|
||||
|
||||
@ -72,9 +72,9 @@ class AUTHORIZATION
|
||||
}
|
||||
|
||||
|
||||
if( $routingName == LOGIN || $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y || $routingName == ROUTE_LOGIN_Z || $routingName == ROUTE_LOGIN_W || $routingName == ROUTE_LOGIN_V || $routingName == ROUTE_LOGIN_A || $routingName == TURN_SERVER_API || $routingName == VIDEO_CHAT_ACCESS_KEY_API || $routingName ==SAVEROOMINFO_API || $routingName ==SAVESMCCREDITPDIMAGE_API || $routingName ==GETSMCPDIMGSECTIONDATA_API || $routingName == ROUTE_LOGIN_T || $routingName == ROUTE_LOGIN_U || $routingName == ROUTE_LOGIN_B || $routingName == ROUTE_LOGIN_C || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E || $routingName == ROUTE_LOGIN_F || $routingName == ROUTE_LOGIN_Q || $routingName == ROUTE_LOGIN_R || $routingName == ROUTE_LOGIN_S || $routingName == ROUTE_LOGIN_G || $routingName == ROUTE_LOGIN_H || $routingName == ROUTE_LOGIN_I || $routingName == ROUTE_LOGIN_J)
|
||||
if( $routingName == cetNewSalesPD || $routingName == LOGIN || $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y || $routingName == ROUTE_LOGIN_Z || $routingName == ROUTE_LOGIN_W || $routingName == ROUTE_LOGIN_V || $routingName == ROUTE_LOGIN_A || $routingName == TURN_SERVER_API || $routingName == VIDEO_CHAT_ACCESS_KEY_API || $routingName ==SAVEROOMINFO_API || $routingName ==SAVESMCCREDITPDIMAGE_API || $routingName ==GETSMCPDIMGSECTIONDATA_API || $routingName == ROUTE_LOGIN_T || $routingName == ROUTE_LOGIN_U || $routingName == ROUTE_LOGIN_B || $routingName == ROUTE_LOGIN_C || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E || $routingName == ROUTE_LOGIN_F || $routingName == ROUTE_LOGIN_Q || $routingName == ROUTE_LOGIN_R || $routingName == ROUTE_LOGIN_S || $routingName == ROUTE_LOGIN_G || $routingName == ROUTE_LOGIN_H || $routingName == ROUTE_LOGIN_I || $routingName == ROUTE_LOGIN_J )
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
if (!array_key_exists("Authorization",$headersData) OR $headersData['Authorization']!=$CI->config->item('authorization_key'))
|
||||
{
|
||||
@ -86,20 +86,20 @@ class AUTHORIZATION
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
else if(isset($headersData['mode']))
|
||||
{
|
||||
if($headersData['mode'] == '0777')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$validateToken = self::validateTimestamp();
|
||||
return $validateToken;
|
||||
}
|
||||
}
|
||||
//not checking routes of applicant img capturing functionality
|
||||
else if( $routingName == 'getPDImgDetails' || $routingName == 'uploadPDImgByApplicant')
|
||||
else if(isset($headersData['mode']))
|
||||
{
|
||||
if($headersData['mode'] == '0777')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$validateToken = self::validateTimestamp();
|
||||
return $validateToken;
|
||||
}
|
||||
}
|
||||
//not checking routes of applicant img capturing functionality
|
||||
else if( $routingName == 'getPDImgDetails' || $routingName == 'uploadPDImgByApplicant')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -145,6 +145,10 @@ class AUTHORIZATION
|
||||
|
||||
|
||||
return $validateToken;
|
||||
}
|
||||
//For SMC CET AutoLogin
|
||||
else if($routingName == cetNewSalesPD){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user