Community discussions

MikroTik App
 
kmullen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Thu Dec 30, 2004 9:48 pm

Please Help with automatic Hotspot login

Tue May 18, 2010 11:24 pm

I have setup a basic hotspot which works with the MT defaults. I want to use rlogin.html to automatically login a user then forward to an external page where we will collect some customer info.

I have tried several of the various methods in the forums, but when I try to the setup, the browser gets caught in a loop showing the following:

http://192.168.88.1/login?username=saya ... ayachtclub

But it does not login the user and go to the redirect page. I have spent over 15 hours going through the forums and trying various things and I am running out of time. I need to install tomorrow. Can someone please help.

:shock:
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Please Help with automatic Hotspot login

Tue May 18, 2010 11:37 pm

That will log the user in, if the credentials actually work. You then need to make an alogin.html that in turn redirects to the final landing page, or you need to add another GET parameter:
http://router/login?username=username&password=password&dst=http://final.landingpage.com
 
kmullen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Thu Dec 30, 2004 9:48 pm

Re: Please Help with automatic Hotspot login

Wed May 19, 2010 12:17 am

Again, it just cycles.

Here is my html code.

<html>
<head>
<meta http-equiv="refresh" content="0; url=login?username=sayachtclub&password=sayachtclub">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
<body>
</body>
</html>

The username and password are valid, and I can use them to login before I modified the login.html on the MT.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Please Help with automatic Hotspot login

Wed May 19, 2010 12:20 am

What happens when you add the dst GET parameter?
 
kmullen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Thu Dec 30, 2004 9:48 pm

Re: Please Help with automatic Hotspot login

Wed May 19, 2010 12:27 am

I see the code but how and where do I put that?
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Please Help with automatic Hotspot login

Wed May 19, 2010 12:33 am

I just tried the following in a lab on 4.5, and it works just fine:
[admin@MikroTik] > /ip hotspot user profile print where name=test
Flags: * - default 
 0   name="test" idle-timeout=none keepalive-timeout=2m status-autorefresh=1m shared-users=1 rate-limit="128k/128k" transparent-proxy=yes open-status-page=always advertise=no 
[admin@MikroTik] > /ip hotspot user print detail where name=test
Flags: X - disabled, D - dynamic 
 0   name="test" password="test" profile=test uptime=6d6h33m27s bytes-in=5805962 bytes-out=109979405 packets-in=73738 packets-out=89166 
[admin@MikroTik] > 
Only four files in the directory. alogin.html, login.html, logout.html and redirect.html.

logout.html and redirect.html both have the same content:
<html>
<head>
<meta http-equiv="refresh" content="0; url=login.html">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
<body>
</body>
</html>
login.html does the automatic login:
<html>
<head>
<meta http-equiv="refresh" content="0; url=login?username=test&password=test">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
<body>
</body>
</html>
alogin.html does the redirect after the successful login, in this case to Google:
<html>
<head>
<meta http-equiv="refresh" content="0; url=http://www.google.com">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
<body>
</body>
</html>

Again, this is working fine in the lab.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Please Help with automatic Hotspot login

Wed May 19, 2010 12:34 am

I see the code but how and where do I put that?
Instead of
<meta http-equiv="refresh" content="0; url=login?username=sayachtclub&password=sayachtclub">
In your HTML, use this line instead:
http://router/login?username=username&password=password&dst=http://final.landingpage.com
But what I just posted above with an alogin.html is cleaner. If you use the method in this post instead edit the login.html and add that dst GET parameter as described and delete the alogin.html completely, leaving only redirect.html, logout.html and login.html.
 
kmullen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Thu Dec 30, 2004 9:48 pm

Re: Please Help with automatic Hotspot login

Wed May 19, 2010 1:02 am

Those are the exact files we used. I have attached my copies.

It just loops and fails to login the user.

Login:

<html>
<head>
<meta http-equiv="refresh" content="0; url=login?username=sayachtclub&password=sayachtclub">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
<body>
</body>
</html>

alogin

<html>
<head>
<meta http-equiv="refresh" content="0; url=http://topguncom.net/SAYachtClub/sayachtclub.html">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
<body>
</body>
</html>

redirect and logout.

<html>
<head>
<meta http-equiv="refresh" content="0; url=login.html">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
<body>
</body>
</html>
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Please Help with automatic Hotspot login

Wed May 19, 2010 1:09 am

What do the logs say about the login failure?
 
kmullen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Thu Dec 30, 2004 9:48 pm

Re: Please Help with automatic Hotspot login

Wed May 19, 2010 1:22 am

They were saying that password was not chap encrypted.

I changed it to HTTP PAP and it process correctly.

Should I setup CHAP? How?

How many users can login with this username and password?
 
kmullen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Thu Dec 30, 2004 9:48 pm

Re: Please Help with automatic Hotspot login

Thu May 20, 2010 5:01 am

:D

Just wanted to take a couple of minutes to thank all of you for your help.

Hotspot is working and forwarding to external page just fine.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Please Help with automatic Hotspot login

Thu May 20, 2010 4:17 pm

Should I setup CHAP? How?
I have no idea, I do not use CHAP anywhere. I use HTTPS instead, which also protects the credentials.
How many users can login with this username and password?
That depends on the "shared user" property of the user profile that user account is linked to, as well as your license level.
 
ciphercore
Member Candidate
Member Candidate
Posts: 155
Joined: Fri Jan 29, 2010 5:48 pm

Re: Please Help with automatic Hotspot login

Thu May 20, 2010 9:55 pm

fewi: Do you just grab a cheap SSL cert and throw it on the MT ?
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Please Help with automatic Hotspot login

Thu May 20, 2010 10:10 pm

That would work. We have a lot of equipment so we actually use a wildcard certificate - it's fairly expensive but can be re-used since all the equipment carries the same domain name.
 
Nomis
just joined
Posts: 12
Joined: Sat Jul 25, 2009 3:45 pm

Re: Please Help with automatic Hotspot login

Fri Feb 17, 2012 8:29 am

Hi all

Firstly thanks for the posts, it works great. However, the redirect shows up in the Browser bar and the Title bars. Which means anyone looking carefully will see the user-name and password.

Is there anyway to hide the info. I am not a web designer so don't know HTML at all
 
User avatar
JHOELIT
just joined
Posts: 12
Joined: Sun Sep 03, 2017 1:12 pm
Location: Perú
Contact:

Re: Please Help with automatic Hotspot login

Tue Apr 17, 2018 7:43 am

Trial Hotspot - Error 404: Not found - 100% Solution

We edit the file (login.html) with notepad ++

1.- The first thing we do is search: link-orig-esc
2.- After we have found we select:

href="$%28link-login-only%29?dst=$%28link-orig-esc%29&amp;username=T-$%28mac-esc%29"

3.- And we replace it with this one:

href="$(link-login-only)?dst=$(link-orig-esc)&amp;username=T-$(mac-esc)"

Do not forget the quotes " " ... God bless you!


TRANSLATION TO SPANISH


Trial Hotspot - Error 404: Not found - Solucion 100%

Editamos el archivo (login.html) con notepad++

1.- Lo primero que hacemos es buscar: link-orig-esc
2.- Luego que hemos encontrado seleccionamos:

href="$%28link-login-only%29?dst=$%28link-orig-esc%29&amp;username=T-$%28mac-esc%29"

3.- Y lo reemplazamos por este otro:

href="$(link-login-only)?dst=$(link-orig-esc)&amp;username=T-$(mac-esc)"

Ojo no olvidarse de las comillas " " ... Dios los bendiga !!!