ppoe_password Set to package

This commit is contained in:
Ibnu Maksum 2023-08-14 13:21:41 +07:00
parent 5b7e84fb75
commit d9bda444e9
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
8 changed files with 41 additions and 7 deletions

View File

@ -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',

View File

@ -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)
);
}

View File

@ -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;

View File

@ -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;

View File

@ -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';

View File

@ -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`;"
]
}

View File

@ -45,6 +45,13 @@
<input type="text" class="form-control" autocomplete="off" required id="password" name="password">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('PPPOE Password')}</label>
<div class="col-md-6">
<input type="password" class="form-control" id="pppoe_password" name="pppoe_password" value="{$d['pppoe_password']}">
<span class="help-block">{Lang::T('User Cannot change this, only admin. if it Empty it will use user password')}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">

View File

@ -43,10 +43,17 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Password']}</label>
<div class="col-md-6">
<input type="password" class="form-control" id="password" name="password">
<input type="password" autocomplete="off" class="form-control" id="password" name="password" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'" value="{$d['password']}">
<span class="help-block">{$_L['password_change_help']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('PPPOE Password')}</label>
<div class="col-md-6">
<input type="password" autocomplete="off" class="form-control" id="pppoe_password" name="pppoe_password" value="{$d['pppoe_password']}" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
<span class="help-block">{Lang::T('User Cannot change this, only admin. if it Empty it will use user password')}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">