Radius name reserved
This commit is contained in:
parent
b2a99def98
commit
0bb20d4a16
@ -42,47 +42,31 @@ switch ($action) {
|
||||
|
||||
$c = ORM::for_table('tbl_user_recharges')->where('username', $user['username'])->find_one();
|
||||
if ($c) {
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setHotspotUser($client, $c['username'], $npass);
|
||||
Mikrotik::removeHotspotActiveUser($client, $user['username']);
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one();
|
||||
if($p['is_radius']){
|
||||
if($c['type'] == 'Hotspot' || ($c['type'] == 'PPPOE' && empty($d['pppoe_password']))){
|
||||
Radius::customerAdd($d, $p);
|
||||
}
|
||||
$d->password = $npass;
|
||||
$d->save();
|
||||
|
||||
_msglog('s', $_L['Password_Changed_Successfully']);
|
||||
_log('[' . $user['username'] . ']: Password changed successfully', 'User', $user['id']);
|
||||
|
||||
r2(U . 'login');
|
||||
} else {
|
||||
if (!$config['radius_enable']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if(!empty($d['pppoe_password'])){
|
||||
Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']);
|
||||
}else{
|
||||
Mikrotik::setPpoeUser($client, $c['username'], $npass);
|
||||
}
|
||||
}else{
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
Mikrotik::setHotspotUser($client, $c['username'], $npass);
|
||||
Mikrotik::removeHotspotActiveUser($client, $user['username']);
|
||||
} else if(empty($d['pppoe_password'])){
|
||||
// only change when pppoe_password empty
|
||||
Mikrotik::setPpoeUser($client, $c['username'], $npass);
|
||||
Mikrotik::removePpoeActive($client, $user['username']);
|
||||
}
|
||||
$d->password = $npass;
|
||||
$d->save();
|
||||
|
||||
_msglog('s', $_L['Password_Changed_Successfully']);
|
||||
_log('[' . $user['username'] . ']: Password changed successfully', 'User', $user['id']);
|
||||
|
||||
r2(U . 'login');
|
||||
}
|
||||
} else {
|
||||
$d->password = $npass;
|
||||
$d->save();
|
||||
|
||||
_msglog('s', $_L['Password_Changed_Successfully']);
|
||||
_log('[' . $user['username'] . ']: Password changed successfully', 'User', $user['id']);
|
||||
|
||||
r2(U . 'login');
|
||||
}
|
||||
$d->password = $npass;
|
||||
$d->save();
|
||||
|
||||
_msglog('s', $_L['Password_Changed_Successfully']);
|
||||
_log('[' . $user['username'] . ']: Password changed successfully', 'User', $user['id']);
|
||||
|
||||
r2(U . 'login');
|
||||
} else {
|
||||
r2(U . 'accounts/change-password', 'e', $_L['Incorrect_Current_Password']);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_pool')->find_one($id);
|
||||
$mikrotik = Mikrotik::info($d['routers']);
|
||||
if ($d) {
|
||||
if (!$config['radius_enable']) {
|
||||
if ($d['routers']!='radius') {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removePool($client, $d['pool_name']);
|
||||
}
|
||||
@ -100,7 +100,7 @@ switch ($action) {
|
||||
}
|
||||
$mikrotik = Mikrotik::info($routers);
|
||||
if ($msg == '') {
|
||||
if (!$config['radius_enable'] && $routers != 'radius') {
|
||||
if ($routers != 'radius') {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::addPool($client, $name, $ip_address);
|
||||
}
|
||||
|
@ -88,10 +88,12 @@ switch ($action) {
|
||||
if ($d) {
|
||||
$msg .= $_L['Router_already_exist'] . '<br>';
|
||||
}
|
||||
|
||||
Mikrotik::getClient($ip_address, $username, $password);
|
||||
if (strtolower($name) == 'radius') {
|
||||
$msg .= '<b>Radius</b> name is reserved<br>';
|
||||
}
|
||||
|
||||
if ($msg == '') {
|
||||
Mikrotik::getClient($ip_address, $username, $password);
|
||||
run_hook('add_router'); #HOOK
|
||||
$d = ORM::for_table('tbl_routers')->create();
|
||||
$d->name = $name;
|
||||
@ -146,11 +148,13 @@ switch ($action) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Mikrotik::getClient($ip_address, $username, $password);
|
||||
if (strtolower($name) == 'radius') {
|
||||
$msg .= '<b>Radius</b> name is reserved<br>';
|
||||
}
|
||||
|
||||
|
||||
if ($msg == '') {
|
||||
Mikrotik::getClient($ip_address, $username, $password);
|
||||
run_hook('router_edit'); #HOOK
|
||||
$d->name = $name;
|
||||
$d->ip_address = $ip_address;
|
||||
|
Loading…
x
Reference in New Issue
Block a user