1
0
mirror of https://github.com/eworm-de/routeros-scripts.git synced 2024-05-11 05:55:19 +00:00

hotspot-to-wpa: fail on missing context

This commit is contained in:
Christian Hesse
2023-06-11 22:52:10 +02:00
parent a4354d762f
commit 2f399f2a48

View File

@@ -16,6 +16,11 @@
:local MacAddress $"mac-address"; :local MacAddress $"mac-address";
:local UserName $username; :local UserName $username;
:if ([ :typeof $MacAddress ] = "nothing" || [ :typeof $UserName ] = "nothing") do={
$LogPrintExit2 error $0 ("This script is supposed to run from hotspot on login.") true;
}
:local Date [ /system/clock/get date ]; :local Date [ /system/clock/get date ];
:local UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ]; :local UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
:local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ]; :local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ];