Virtual SmartZone html login form example

  • 1
  • Question
  • Updated 2 months ago
Does someone has a captive portal login form with POST action and required hidden fields example to use with VirtualSmartZone?

Thanks!
Photo of Cristiano Bevilaqua

Cristiano Bevilaqua

  • 13 Posts
  • 0 Reply Likes

Posted 2 months ago

  • 1
Photo of Vivek Gupta

Vivek Gupta, Employee

  • 14 Posts
  • 4 Reply Likes
Hi Cristiano,

May be you can you try this below . Replace x.x.x.x with the ZD IP address.

<html> 
<head><title>Wireless Internet Service</title></head> 
<body> 
<br/><center><h2>Wireless Internet Service</h2> 
<form action="http://x.x.x.x:9997/login">
<table border="0" cellpadding="5" cellspacing="0" style="width: 200px;"> 
<tr><th>Username:</th><td><input type="text" name="username" size="20"></td></tr> 
<tr><th>Password:</th><td><input type="password" name="password" size="20"></td></tr> 
<tr><td align="center" colspan="2" height="23"><input type="submit" value="Login"></td></tr> 
</table></form> 
</body> 
</html> 

Regards,
Vivek Gupta
Photo of Cristiano Bevilaqua

Cristiano Bevilaqua

  • 13 Posts
  • 0 Reply Likes
Thanks! I'm going to use this with Zone Director.
(Edited)
Photo of Jeronimo

Jeronimo

  • 217 Posts
  • 25 Reply Likes
Hi.

If you use above code, you'll meet failure to authentication because SZ an ZD have different form code.


----------------------------------------------

<html>
<head>
<title>Wireless Internet Service</title>
<script type="text/javascript">
function get_param(name)
{
    if (location.href.indexOf("?") >= 0) 
    { 
        var query=location.href.split("?")[1];
        var params=query.split("&");
        for (var i = 0; i < params.length; i ++) {
             value_pair=params[i].split("=");
            if (value_pair[0] == name)
                 return unescape(value_pair[1]);
        }
    }
    return "";
}
function get_sip() {
    var sip = get_param("sip");
   //var sip = "172.21.144.65"; -----> if you need to static ip, write the ip here


    if (sip.indexOf(":") < 0) { // IPv4 address
        return sip;
    } else {                    // IPv6 address
        return '[' + sip + ']';
    }
}

</script>
</head>

<body>
<center>
<h2>Wireless Internet Service for SmartZone</h2>
<script type="text/javascript">
document.write('<form method=POST action="http://' + get_sip() + ':9997/SubscriberPortal/hotspotlogin">');
document.write('<input type="hidden" name="url" value="'+get_param("url")+'" />');
document.write('<input type="hidden" name="proxy" value="'+get_param("proxy")+'" />');
document.write('<input type="hidden" name="uip" value="'+get_param("uip")+'" />');
document.write('<input type="hidden" name="client_mac" value="'+get_param("client_mac")+'" />');

</script>
Username:<input type="text" name="username">
Password:<input type="password" name="password" >
<input type="submit" value="Login">
</form>
</center>
</body>
</html>


----------------------------------------------

Above code will be parsing to controller ip automatically.

Regards.
Photo of Cristiano Bevilaqua

Cristiano Bevilaqua

  • 13 Posts
  • 0 Reply Likes
Thanks! This is the correct example for Virtual SmartZone. Worked ok!
(Edited)