diff --git a/system/controllers/routers.php b/system/controllers/routers.php
index acade1d3..a507207a 100644
--- a/system/controllers/routers.php
+++ b/system/controllers/routers.php
@@ -12,9 +12,7 @@ $ui->assign('_system_menu', 'network');
$action = $routes['1'];
$ui->assign('_admin', $admin);
-use PEAR2\Net\RouterOS;
-
-require_once 'system/autoload/PEAR2/Autoload.php';
+require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . "MikrotikHotspot.php";
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
@@ -93,8 +91,10 @@ switch ($action) {
}
if ($msg == '') {
- Mikrotik::getClient($ip_address, $username, $password);
run_hook('add_router'); #HOOK
+ if(_post("testIt")){
+ (new MikrotikHotspot())->getClient($ip_address, $username, $password);
+ }
$d = ORM::for_table('tbl_routers')->create();
$d->name = $name;
$d->ip_address = $ip_address;
@@ -152,10 +152,11 @@ switch ($action) {
$msg .= 'Radius name is reserved
';
}
-
if ($msg == '') {
- Mikrotik::getClient($ip_address, $username, $password);
run_hook('router_edit'); #HOOK
+ if(_post("testIt")){
+ (new MikrotikHotspot())->getClient($ip_address, $username, $password);
+ }
$d->name = $name;
$d->ip_address = $ip_address;
$d->username = $username;
diff --git a/ui/ui/routers-add.tpl b/ui/ui/routers-add.tpl
index c9cca4e7..5d2ef2c6 100644
--- a/ui/ui/routers-add.tpl
+++ b/ui/ui/routers-add.tpl
@@ -53,6 +53,12 @@
{Lang::T('Explain Coverage of router')}
+