Community discussions

MikroTik App
 
User avatar
techguy79
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Tue Mar 24, 2009 10:34 pm
Contact:

Hotspot automated pw change weekly based on month and day

Thu Jul 31, 2014 11:27 pm

I know this has to be easy to do compared to some of the other hotspot pw change scripts I've seen out there.
We have a new company we are taking over support on(hotel). They insist we follow the same hotspot password change context they currently have in place.
The current system in place is going away once we assume responsibility his web portal solution is hosted on his own web server so it goes with them.
Currently the system we need to emulate sets the hotspot password to the first 3 character of the month ie Jul for July and the date and combines it like Jul31.
In pseudo code my logic is this in the script grab the date declare month using :pick to only hold first 3 characters of the month then in a separate declaration declare the day of the month portion.
then declare a new variable which contains the 3 character representation of the month + day of month as variable we'll call newPassword
then issue the :set newPassword($3character variable representing the month . $day of the month variable
/ip hotspot user set [/ip hotspot user find name=user1"] password=$newPassword

I'd appreciate any assistance in this.
 
User avatar
techguy79
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Tue Mar 24, 2009 10:34 pm
Contact:

Re: Hotspot automated pw change weekly based on month and da

Fri Aug 01, 2014 12:27 am

OK I figured it out...
This works but is there anyway to convert the 3 character representation of the month to uppercase as I use a javascript function on our portal page that converts the password field to uppercase to avoid case sensitive issues ?

:local date [/system clock get date];
:local day [:pick $date 4 6];
:local month [:pick $date 0 3];
:local newPassword ($month . $day);

/ip hotspot user set [/ip hotspot user find name "user1"] password="$newPassword";


/tool e-mail send \ to=support@abc.com \
subject="xxxxxxxx New Hotspot \ Access Code" \
tls=yes from=support@abc.com server=xxx.xxx.xxx.xxx body="$newPassword"
 
ovdeathiam
just joined
Posts: 21
Joined: Wed Jul 16, 2014 11:15 am

Re: Hotspot automated pw change weekly based on month and da

Fri Aug 01, 2014 5:39 pm

Can you try this?
:local date [/system clock get date];
:local months {jan="JAN";feb="FEB";mar="MAR";apr="APR";may="MAY";jun="JUN";jul="JUL";aug="AUG";sep="SEP";oct="OCT";nov="NOV";dec="DEC"};
:local month ($months->[:pick $date 0 3]);
:local day [:pick $date 4 6];

:local newPassword ($month . $day);

/ip hotspot user set [/ip hotspot user find name "user1"] password="$newPassword"; 
/tool e-mail send \ to=support@abc.com \
subject="xxxxxxxx New Hotspot \ Access Code" \
tls=yes from=support@abc.com server=xxx.xxx.xxx.xxx body="$newPassword"
 
User avatar
techguy79
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Tue Mar 24, 2009 10:34 pm
Contact:

Re: Hotspot automated pw change weekly based on month and da

Fri Aug 01, 2014 10:46 pm

Thanks you for responding, I ended up modifying my javascript function on the login page to convert any text in input box to lower case rather than upper case as it had previously been setup.

Who is online

Users browsing this forum: diamuxin and 9 guests