CMXX - Changed consumer_identity to identity
This commit is contained in:
@@ -52,11 +52,11 @@ if(isset($get_content) && $get_content!=''){
|
|||||||
|
|
||||||
if(isset($criterias['totals']) && $criterias['totals'] ==''){
|
if(isset($criterias['totals']) && $criterias['totals'] ==''){
|
||||||
//Request for total rows
|
//Request for total rows
|
||||||
$sql = 'SELECT count(*) as count from consumer_identity '.$whereclause.'';
|
$sql = 'SELECT count(*) as count from identity '.$whereclause.'';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//SQL for Paging
|
//SQL for Paging
|
||||||
$sql = 'SELECT id,email,profile,first_name,last_name,address_street,address_city,address_state,address_zip,address_country,registered,address_phone,lastlogin,userkey,language,login_count,created,createdby,updated,updatedby,accounthierarchy FROM consumer_identity '.$whereclause.' ORDER BY lastlogin DESC LIMIT :page,:num_products';
|
$sql = 'SELECT id,email,profile,first_name,last_name,address_street,address_city,address_state,address_zip,address_country,registered,address_phone,lastlogin,userkey,language,login_count,created,createdby,updated,updatedby,accounthierarchy FROM identity '.$whereclause.' ORDER BY lastlogin DESC LIMIT :page,:num_products';
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
defined($security_key) or exit;
|
defined($security_key) or exit;
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
// consumer_identity
|
// identity
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
//Connect to DB
|
//Connect to DB
|
||||||
$pdo = dbConnect($dbname);
|
$pdo = dbConnect($dbname);
|
||||||
@@ -47,7 +47,7 @@ $resetkey = generate_jwt($headers, $payload);
|
|||||||
if ($id != '' && $command == 'reset'){
|
if ($id != '' && $command == 'reset'){
|
||||||
|
|
||||||
//STEP 1 - Get username
|
//STEP 1 - Get username
|
||||||
$stmt = $pdo->prepare('SELECT * FROM consumer_identity WHERE userkey = ?');
|
$stmt = $pdo->prepare('SELECT * FROM identity WHERE userkey = ?');
|
||||||
$stmt->execute([$id]);
|
$stmt->execute([$id]);
|
||||||
$consumer_data = $stmt->fetch();
|
$consumer_data = $stmt->fetch();
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ if ($id != '' && $command == 'reset'){
|
|||||||
//ADD STANDARD PARAMETERS TO ARRAY BASED ON INSERT OR UPDATE
|
//ADD STANDARD PARAMETERS TO ARRAY BASED ON INSERT OR UPDATE
|
||||||
if ($command == 'update'){
|
if ($command == 'update'){
|
||||||
//Define Query
|
//Define Query
|
||||||
$stmt = $pdo->prepare('SELECT * FROM consumer_identity WHERE userkey = ?');
|
$stmt = $pdo->prepare('SELECT * FROM identity WHERE userkey = ?');
|
||||||
$stmt->execute([$id]);
|
$stmt->execute([$id]);
|
||||||
$consumer_data = $stmt->fetch();
|
$consumer_data = $stmt->fetch();
|
||||||
|
|
||||||
@@ -78,23 +78,25 @@ if ($command == 'update'){
|
|||||||
|
|
||||||
}
|
}
|
||||||
elseif ($command == 'insert'){
|
elseif ($command == 'insert'){
|
||||||
$post_content['password'] = bin2hex(random_bytes(25)); //generate initial password
|
$post_content['password'] = password_hash($post_content['password'], PASSWORD_DEFAULT);; //generate initial password
|
||||||
$post_content['language'] = isset($post_content['language']) ? $post_content['language'] : 'US';
|
$post_content['language'] = isset($post_content['language']) ? $post_content['language'] : 'US';
|
||||||
|
$post_content['profile'] = 0;
|
||||||
|
$post_content['isverified'] = 0;
|
||||||
}
|
}
|
||||||
elseif ($command == 'login'){
|
elseif ($command == 'login'){
|
||||||
|
|
||||||
//SETUP SQL FOR LOGIN_COUNT
|
//SETUP SQL FOR LOGIN_COUNT
|
||||||
$sql_login = 'UPDATE consumer_identity SET login_count = ? WHERE id = ?';
|
$sql_login = 'UPDATE identity SET login_count = ? WHERE id = ?';
|
||||||
|
|
||||||
// Check if the account exists
|
// Check if the account exists
|
||||||
$stmt = $pdo->prepare('SELECT * FROM consumer_identity WHERE email = ?');
|
$stmt = $pdo->prepare('SELECT * FROM identity WHERE email = ?');
|
||||||
$stmt->execute([ $post_content['email'] ]);
|
$stmt->execute([ $post_content['email'] ]);
|
||||||
$account = $stmt->fetch(PDO::FETCH_ASSOC);
|
$account = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
if (count($account) != 0){
|
if (count($account) != 0){
|
||||||
|
|
||||||
//CHECK NUMBER OF LOGIN ATTEMPTS IS BELOW 5
|
//CHECK NUMBER OF LOGIN ATTEMPTS IS BELOW 5
|
||||||
if($user_data['login_count'] < 5){
|
if($account['login_count'] < 5 || $account['isverified'] == 0 ){
|
||||||
// If account exists verify password
|
// If account exists verify password
|
||||||
if ($account && password_verify($post_content['password'], $account['password'])) {
|
if ($account && password_verify($post_content['password'], $account['password'])) {
|
||||||
|
|
||||||
@@ -128,7 +130,8 @@ elseif ($command == 'login'){
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//User is blocked & send error
|
//User is blocked & send error
|
||||||
$messages = '1';
|
$messages = ($account['isverified'] == 0)? 0 : 1; //0 = not verified 1=blocked
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
//Send results
|
//Send results
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
@@ -163,8 +166,8 @@ $clause_insert = substr($clause_insert, 2); //Clean clause - remove first comma
|
|||||||
$input_insert = substr($input_insert, 1); //Clean clause - remove first comma
|
$input_insert = substr($input_insert, 1); //Clean clause - remove first comma
|
||||||
|
|
||||||
//QUERY AND VERIFY ALLOWED
|
//QUERY AND VERIFY ALLOWED
|
||||||
if ($command == 'update' && (isAllowed('consumer_identity',$profile,$permission,'U') === 1)){
|
if ($command == 'update' && (isAllowed('identity',$profile,$permission,'U') === 1)){
|
||||||
$sql = 'UPDATE consumer_identity SET '.$clause.' WHERE userkey = ? '.$whereclause.'';
|
$sql = 'UPDATE identity SET '.$clause.' WHERE userkey = ? '.$whereclause.'';
|
||||||
|
|
||||||
$execute_input[] = $id;
|
$execute_input[] = $id;
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
@@ -173,19 +176,19 @@ if ($command == 'update' && (isAllowed('consumer_identity',$profile,$permission,
|
|||||||
}
|
}
|
||||||
elseif ($command == 'insert' && isAllowed('',$profile,$permission,'C') === 1){
|
elseif ($command == 'insert' && isAllowed('',$profile,$permission,'C') === 1){
|
||||||
|
|
||||||
//check if consumer_identity exists
|
//check if identity exists
|
||||||
$stmt = $pdo->prepare('SELECT * FROM consumer_identity WHERE email = ?');
|
$stmt = $pdo->prepare('SELECT * FROM identity WHERE email = ?');
|
||||||
$stmt->execute([$post_content['email']]);
|
$stmt->execute([$post_content['email']]);
|
||||||
$consumer_exist = $stmt->fetch();
|
$consumer_exist = $stmt->fetch();
|
||||||
|
|
||||||
$exists = (isset($consumer_exist['email']))? 1 : 0;
|
$exists = (isset($consumer_exist['email']))? 1 : 0;
|
||||||
if($consumer_exist == 0 ){
|
if($consumer_exist == 0 ){
|
||||||
$sql = 'INSERT INTO consumer_identity ('.$clause_insert.') VALUES ('.$input_insert.')';
|
$sql = 'INSERT INTO identity ('.$clause_insert.') VALUES ('.$input_insert.')';
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
$stmt->execute($execute_input);
|
$stmt->execute($execute_input);
|
||||||
|
|
||||||
//STEP 2- Send to user
|
//STEP 2- Send to user
|
||||||
$messages = json_encode(array('consumer_email'=> $post_content['email'], "resetkey" => $resetkey), JSON_UNESCAPED_UNICODE);
|
$messages = json_encode(array('consumer_email'=> $post_content['email'],'accountID' => $account['userkey'],'profile' => $post_content['profile'], 'resetkey' => $resetkey), JSON_UNESCAPED_UNICODE);
|
||||||
//Send results
|
//Send results
|
||||||
echo $messages;
|
echo $messages;
|
||||||
exit;
|
exit;
|
||||||
@@ -199,13 +202,13 @@ elseif ($command == 'insert' && isAllowed('',$profile,$permission,'C') === 1){
|
|||||||
echo $messages;
|
echo $messages;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($command == 'delete' && isAllowed('consumer_identity',$profile,$permission,'D') === 1){
|
elseif ($command == 'delete' && isAllowed('identity',$profile,$permission,'D') === 1){
|
||||||
//delete equipment
|
//delete equipment
|
||||||
$stmt = $pdo->prepare('DELETE FROM consumer_identity WHERE userkey = ? '.$whereclause.'');
|
$stmt = $pdo->prepare('DELETE FROM identity WHERE userkey = ? '.$whereclause.'');
|
||||||
$stmt->execute([ $id ]);
|
$stmt->execute([ $id ]);
|
||||||
|
|
||||||
//Add deletion to changelog
|
//Add deletion to changelog
|
||||||
changelog($dbname,'consumer_identity',$id,'Delete','Delete',$consumername);
|
changelog($dbname,'identity',$id,'Delete','Delete',$consumername);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
//do nothing
|
//do nothing
|
||||||
@@ -47,11 +47,11 @@ $main_menu = [
|
|||||||
"icon" => "fas fa-tachometer-alt",
|
"icon" => "fas fa-tachometer-alt",
|
||||||
"name" => "menu_sales_orders"
|
"name" => "menu_sales_orders"
|
||||||
],
|
],
|
||||||
"consumer_identity" => [
|
"identity" => [
|
||||||
"url" => "consumer_identity",
|
"url" => "identity",
|
||||||
"selected" => "consumer_identity",
|
"selected" => "identity",
|
||||||
"icon" => "fas fa-tachometer-alt",
|
"icon" => "fas fa-tachometer-alt",
|
||||||
"name" => "menu_consumer_identity"
|
"name" => "menu_identity"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"buildtool" => [
|
"buildtool" => [
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ define('superuser_profile','dashboard,profile,assets,equipments,equipment,equipm
|
|||||||
/*Admin*/
|
/*Admin*/
|
||||||
define('admin_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,rmas,rma,rma_manage,rma_history,rma_history_manage,buildtool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,changelog,application');
|
define('admin_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,rmas,rma,rma_manage,rma_history,rma_history_manage,buildtool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,changelog,application');
|
||||||
/*AdminPlus*/
|
/*AdminPlus*/
|
||||||
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,billing,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,rmas,rma,rma_manage,rma_history,rma_history_manage,buildtool,products,products_versions,products_software,products_attributes,products_attributes_items,products_attributes_manage,products_configurations,products_categories,products_media,product,product_manage,pricelists,pricelists_items,pricelists_manage,catalog,categories,category,discounts,discount,shipping,shipping_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,report_usage,config,settings,logfile,changelog,language,translations,translations_details,translation_manage,media,media_manage,application,maintenance,uploader,profiles,vin,shopping_cart,checkout,placeorder,taxes,transactions,transactions_items,invoice,order,orders,consumer_identity');
|
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,billing,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,rmas,rma,rma_manage,rma_history,rma_history_manage,buildtool,products,products_versions,products_software,products_attributes,products_attributes_items,products_attributes_manage,products_configurations,products_categories,products_media,product,product_manage,pricelists,pricelists_items,pricelists_manage,catalog,categories,category,discounts,discount,shipping,shipping_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,report_usage,config,settings,logfile,changelog,language,translations,translations_details,translation_manage,media,media_manage,application,maintenance,uploader,profiles,vin,shopping_cart,checkout,placeorder,taxes,transactions,transactions_items,invoice,order,orders,identity');
|
||||||
/*Build*/
|
/*Build*/
|
||||||
define('build','dashboard,profile,buildtool,firmwaretool,buildtool,products_software,application');
|
define('build','dashboard,profile,buildtool,firmwaretool,buildtool,products_software,application');
|
||||||
/*Commerce*/
|
/*Commerce*/
|
||||||
define('commerce','dashboard,profile,products,products_versions,products_software,products_attributes,products_attributes_items,products_attributes_manage,products_configurations,products_categories,products_media,product,product_manage,pricelists,pricelists_items,pricelists_manage,catalog,categories,category,discounts,discount,shipping,shipping_manage,admin,partners,partner,users,user,user_manage,translations,translations_details,translation_manage,media,media_manage,application,uploader,shopping_cart,checkout,placeorder,taxes,transactions,transactions_items,invoice,order,orders,consumer_identity');
|
define('commerce','dashboard,profile,products,products_versions,products_software,products_attributes,products_attributes_items,products_attributes_manage,products_configurations,products_categories,products_media,product,product_manage,pricelists,pricelists_items,pricelists_manage,catalog,categories,category,discounts,discount,shipping,shipping_manage,admin,partners,partner,users,user,user_manage,translations,translations_details,translation_manage,media,media_manage,application,uploader,shopping_cart,checkout,placeorder,taxes,transactions,transactions_items,invoice,order,orders,identity');
|
||||||
/*Distribution*/
|
/*Distribution*/
|
||||||
define('distribution','dashboard,profile,assets,equipments,equipment,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,marketing,application');
|
define('distribution','dashboard,profile,assets,equipments,equipment,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,marketing,application');
|
||||||
/*Firmware*/
|
/*Firmware*/
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ $all_views = [
|
|||||||
"invoice",
|
"invoice",
|
||||||
"order",
|
"order",
|
||||||
"orders",
|
"orders",
|
||||||
"consumer_identity"
|
"identity"
|
||||||
];
|
];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user