diff --git a/install/phpnuxbill.sql b/install/phpnuxbill.sql index 21690f98..a7e6d6ef 100644 --- a/install/phpnuxbill.sql +++ b/install/phpnuxbill.sql @@ -50,7 +50,7 @@ CREATE TABLE `id` int(10) NOT NULL, `username` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `pppoe_password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `pppoe_password` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1', `fullname` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `address` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci, `phonenumber` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0', diff --git a/system/autoload/Mikrotik.php b/system/autoload/Mikrotik.php index 0b98ecd4..3e6fc2ae 100644 --- a/system/autoload/Mikrotik.php +++ b/system/autoload/Mikrotik.php @@ -216,12 +216,17 @@ class Mikrotik public static function addPpoeUser($client, $plan, $customer) { $addRequest = new RouterOS\Request('/ppp/secret/add'); + if(!empty($customer['pppoe_password'])){ + $pass = $customer['pppoe_password']; + }else{ + $pass = $customer['password']; + } $client->sendSync( $addRequest ->setArgument('name', $customer['username']) ->setArgument('service', 'pppoe') ->setArgument('profile', $plan['name_plan']) - ->setArgument('password', $customer['password']) + ->setArgument('password', $pass) ); } diff --git a/system/controllers/accounts.php b/system/controllers/accounts.php index b586fdb2..559d7bd2 100644 --- a/system/controllers/accounts.php +++ b/system/controllers/accounts.php @@ -59,7 +59,11 @@ switch ($action) { } else { if (!$config['radius_mode']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); - Mikrotik::setPpoeUser($client, $c['username'], $npass); + if(!empty($d['pppoe_password'])){ + Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']); + }else{ + Mikrotik::setPpoeUser($client, $c['username'], $npass); + } Mikrotik::removePpoeActive($client, $user['username']); } $d->password = $npass; diff --git a/system/controllers/customers.php b/system/controllers/customers.php index 96f99356..cd12ed48 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -116,6 +116,7 @@ switch ($action) { $username = _post('username'); $fullname = _post('fullname'); $password = _post('password'); + $pppoe_password = _post('pppoe_password'); $email = _post('email'); $address = _post('address'); $phonenumber = _post('phonenumber'); @@ -140,6 +141,7 @@ switch ($action) { $d = ORM::for_table('tbl_customers')->create(); $d->username = Lang::phoneFormat($username); $d->password = $password; + $d->pppoe_password = $pppoe_password; $d->email = $email; $d->fullname = $fullname; $d->address = $address; @@ -155,6 +157,7 @@ switch ($action) { $username = Lang::phoneFormat(_post('username')); $fullname = _post('fullname'); $password = _post('password'); + $pppoe_password = _post('pppoe_password'); $email = _post('email'); $address = _post('address'); $phonenumber = Lang::phoneFormat(_post('phonenumber')); @@ -201,7 +204,11 @@ switch ($action) { } else { if(!$config['radius_mode']){ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); - Mikrotik::setPpoeUser($client,$c['username'],$password); + if(!empty($d['pppoe_password'])){ + Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']); + }else{ + Mikrotik::setPpoeUser($client, $c['username'], $password); + } Mikrotik::removePpoeActive($client,$user['username']); } @@ -212,6 +219,7 @@ switch ($action) { if ($password != '') { $d->password = $password; } + $d->pppoe_password = $pppoe_password; $d->fullname = $fullname; $d->email = $email; $d->address = $address; @@ -223,6 +231,7 @@ switch ($action) { $d->password = $password; } $d->fullname = $fullname; + $d->pppoe_password = $pppoe_password; $d->email = $email; $d->address = $address; $d->phonenumber = $phonenumber; diff --git a/system/lan/english/common.lan.php b/system/lan/english/common.lan.php index 1798dfb4..89a725d8 100644 --- a/system/lan/english/common.lan.php +++ b/system/lan/english/common.lan.php @@ -351,3 +351,5 @@ $_L['Reminder_Notification_Message'] = 'Reminder Notification Message'; $_L['Reminder_7_days'] = 'Reminder 7 days'; $_L['Reminder_3_days'] = 'Reminder 3 days'; $_L['Reminder_1_day'] = 'Reminder 1 day'; +$_L['PPPOE_Password'] = 'PPPOE Password'; +$_L['User_Cannot_change_this_only_admin_if_it_Empty_it_will_use_user_password'] = 'User Cannot change this, only admin. if it Empty it will use user password'; diff --git a/system/updates.json b/system/updates.json index c27e1150..c825cc63 100644 --- a/system/updates.json +++ b/system/updates.json @@ -1,11 +1,11 @@ { "2023.8.9": [ - "ALTER TABLE `tbl_customers` ADD `balance` decimal(15,2) NOT NULL COMMENT 'For Money Deposit' AFTER `email`;", + "ALTER TABLE `tbl_customers` ADD `balance` decimal(15,2) NOT NULL DEFAULT 0.00 COMMENT 'For Money Deposit' AFTER `email`;", "CREATE TABLE `tbl_customers_meta` (`id` int(11) NOT NULL, `customer_id` int(11) NOT NULL,`meta_key` varchar(64) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', `meta_value` longtext COLLATE utf8mb4_general_ci) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;", "ALTER TABLE `tbl_customers_meta` ADD PRIMARY KEY (`id`);", "ALTER TABLE `tbl_customers_meta` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;" ], "2023.8.14": [ - "ALTER TABLE `tbl_customers` ADD `pppoe_password` varchar(45) NOT NULL COMMENT 'For PPPOE Login' AFTER `password`;" + "ALTER TABLE `tbl_customers` ADD `pppoe_password` varchar(45) NOT NULL DEFAULT '1' COMMENT 'For PPPOE Login' AFTER `password`;" ] } \ No newline at end of file diff --git a/ui/ui/customers-add.tpl b/ui/ui/customers-add.tpl index 90b3e94c..c367095e 100644 --- a/ui/ui/customers-add.tpl +++ b/ui/ui/customers-add.tpl @@ -45,6 +45,13 @@ +
+ +
+ + {Lang::T('User Cannot change this, only admin. if it Empty it will use user password')} +
+
diff --git a/ui/ui/customers-edit.tpl b/ui/ui/customers-edit.tpl index a2ae667a..4886620e 100644 --- a/ui/ui/customers-edit.tpl +++ b/ui/ui/customers-edit.tpl @@ -43,10 +43,17 @@
- + {$_L['password_change_help']}
+
+ +
+ + {Lang::T('User Cannot change this, only admin. if it Empty it will use user password')} +
+