Hotspot Login External Page

Hi All,

I am trying to setup an external login page by following instruction in http://wiki.mikrotik.com/wiki/HotSpot_external_login_page

I have setup hotspot in routerboard using Hotspot Setup.

The problem i encounter is if i insert correct path for md5.js in the login page, login will always fail. However if i delete the line that loading md5.js or put wrong path so i can’t load, login will be working fine. Appreciate if anyone can point out what’s wrong with my setup.

You gave no details about your setup, but a clue is that md5.js is required for chap and not pap.

A wild guess:

You have login-by=http-chap and you need login-by=http-pap set, so including md5.js would break things.
Leaving md5.js out should throw a js error in your browser, but the line:

document.sendin.password.value = hexMD5('<?php echo $chapid; ?>' + document.login.password.value + '<?php echo $chapchallenge; ?>');

Would leave the password value unchanged, perhaps, if function hexMD5 is missing. i.e. md5.js is missing.

Check:

/ip hotspot profile print

and check the “login-by” value.

End of wild guess.

the setup was configured using hotspot setup wizard, so all the settings are default. i checked the server profile, it has both http-chap and http-pap enabled.

when i am at the login page, i tried to view html source and able to see some strings generated for hexMD5 line, so i assume this mean that i am on chap ?

It’s difficult to predict what is wrong without all the pieces.

Are you using a radius server or user settings?

What actually happens when you login?

Turn on hotspot and radius logging in the MT and you will see what is going on.

Put an error_log in your php file. Something like:

error_log(print_r($_POST, true));

Then you can see exactly what is posted to your page during the redirect.