Admin can Login as Customer

This commit is contained in:
iBNu Maksum 2024-10-17 15:14:39 +07:00
parent b3744a5007
commit 49f194a7f2
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 27 additions and 6 deletions

View File

@ -261,6 +261,19 @@ switch ($action) {
}
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
break;
case 'login':
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
}
$id = $routes['2'];
$customer = ORM::for_table('tbl_customers')->find_one($id);
if($customer){
$_SESSION['uid'] = $id;
User::setCookie($id);
_alert("You are logging in as $customer[fullname],<br>don't logout just close tab.", 'info', "home", 10);
}
_alert(Lang::T('Customer not found'), 'danger', "customers");
break;
case 'viewu':
$customer = ORM::for_table('tbl_customers')->where('username', $routes['2'])->find_one();
case 'view':

View File

@ -847,5 +847,7 @@
"Update_PHPNuxBill": "Update PHPNuxBill",
"Ask_Github_Community": "Ask Github Community",
"Ask_Telegram_Community": "Ask Telegram Community",
"Transaction_History_List": "Transaction History List"
"Transaction_History_List": "Transaction History List",
"Login_as_Customer": "Login as Customer",
"info": "info"
}

View File

@ -255,16 +255,22 @@
</div>
<hr>
<div class="row">
<div class="col-xs-4">
<div class="col-xs-6 col-md-3">
<a href="{$_url}customers/list" class="btn btn-primary btn-sm btn-block">{Lang::T('Back')}</a>
</div>
<div class="col-xs-4">
<div class="col-xs-6 col-md-3">
<a href="{$_url}customers/sync/{$d['id']}" onclick="return confirm('This will sync Customer to Mikrotik?')"
class="btn btn-info btn-sm btn-block">{Lang::T('Sync')}</a>
</div>
<div class="col-xs-4">
<a href="{$_url}message/send/{$d['id']}" class="btn btn-success btn-sm btn-block">{Lang::T('Send
Message')}</a>
<div class="col-xs-6 col-md-3">
<a href="{$_url}message/send/{$d['id']}" class="btn btn-success btn-sm btn-block">
{Lang::T('Send Message')}
</a>
</div>
<div class="col-xs-6 col-md-3">
<a href="{$_url}customers/login/{$d['id']}" target="_blank" class="btn btn-warning btn-sm btn-block">
{Lang::T('Login as Customer')}
</a>
</div>
</div>