fix radius rest pppoe_username

This commit is contained in:
iBNu Maksum 2024-12-22 15:10:01 +07:00
parent 7c547c967e
commit daf1bb7d67
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5

View File

@ -162,14 +162,16 @@ try {
} }
} }
} else { } else {
$c = ORM::for_table('tbl_customers')->select('password')->select('pppoe_password')->whereRaw("BINARY pppoe_username = '$username' AND status = 'Active'")->find_one(); $c = ORM::for_table('tbl_customers')->select('password')->select('username')->select('pppoe_password')->whereRaw("BINARY pppoe_username = '$username' AND status = 'Active'")->find_one();
if ($c) { if ($c) {
if (Password::chap_verify($c['password'], $CHAPassword, $CHAPchallenge)) { if (Password::chap_verify($c['password'], $CHAPassword, $CHAPchallenge)) {
$password = $c['password']; $password = $c['password'];
$username = $c['username'];
$isVoucher = false; $isVoucher = false;
$isCHAP = true; $isCHAP = true;
} else if (!empty($c['pppoe_password']) && Password::chap_verify($c['pppoe_password'], $CHAPassword, $CHAPchallenge)) { } else if (!empty($c['pppoe_password']) && Password::chap_verify($c['pppoe_password'], $CHAPassword, $CHAPchallenge)) {
$password = $c['pppoe_password']; $password = $c['pppoe_password'];
$username = $c['username'];
$isVoucher = false; $isVoucher = false;
$isCHAP = true; $isCHAP = true;
} else { } else {
@ -202,6 +204,12 @@ try {
} }
} }
$tur = ORM::for_table('tbl_user_recharges')->whereRaw("BINARY username = '$username'")->find_one(); $tur = ORM::for_table('tbl_user_recharges')->whereRaw("BINARY username = '$username'")->find_one();
if (!$tur) {
// if check if pppoe_username
$c = ORM::for_table('tbl_customers')->select('username')->select('pppoe_password')->whereRaw("BINARY pppoe_username = '$username'")->find_one();
$username = $c['username'];
$tur = ORM::for_table('tbl_user_recharges')->whereRaw("BINARY username = '$username'")->find_one();
}
if ($tur) { if ($tur) {
if (!$isVoucher && !$isCHAP) { if (!$isVoucher && !$isCHAP) {
$d = ORM::for_table('tbl_customers')->select('password')->select('pppoe_password')->whereRaw("BINARY username = '$username' AND status = 'Active'")->find_one(); $d = ORM::for_table('tbl_customers')->select('password')->select('pppoe_password')->whereRaw("BINARY username = '$username' AND status = 'Active'")->find_one();