Hello! Installed mikrotik 5.24. Organized hotspot with registration by sms, wrote a script, registration of users via user manager. Everything works quite stable, but the other day and caught a bug script fixated. User has sent three sms, last thing the script was executed
/tool user-manager user add customer=admin disabled=no name=$smsPhone password=$pass shared-users=1 phone=$smsPhone
:log info "3"
The script loops
script code:
/tool sms set receive-enabled=yes
:local smsPhone
:local smsMessage
delay 2;
:foreach i in=[/tool sms inbox find] do={
#Password generation
:local date [/system clock get time]
:local hour [:pick $date 0 2]
:local min [:pick $date 3 5]
:local sec [:pick $date 6 8]
:local pass 27394
:set pass ($hour * $min * $sec)
:if ($pass = 0) do {
:set pass 6524
}
:log info $pass
:log info $date
#End password generation
:set smsPhone [/tool sms inbox get $i phone];
:log info $smsPhone
#Create voucher
/tool user-manager user remove [/tool user-manager user find username=$smsPhone]
:log info "2"
/tool user-manager user add customer=admin disabled=no name=$smsPhone password=$pass shared-users=1 phone=$smsPhone
:log info "3"
#TODO set profile!!!!
/tool user-manager user create-and-activate-profile user=$smsPhone customer=admin profile=hour
:log info "4"
#End create voucher
:set smsMessage "Login: $smsPhone Password: $pass"
:log info $smsMessage
:if ([:len $smsPhone]>10) do {
/tool sms send usb3 $smsPhone message="$smsMessage"
}
:log info "5"
/tool sms inbox remove $i
:log info "6"
delay 10
}