Community discussions

MikroTik App
 
pauljames
just joined
Topic Author
Posts: 6
Joined: Sun Aug 21, 2016 3:10 pm

Hotspot login with password included when submit is clicked

Sat Sep 24, 2016 2:24 am

Hi, trying to change a working login.html. The place no longer wants users to enter any password but still wants the user to click the submit button in order to get internet access.

The current code (head, form without body) is:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/>
<style type="text/css">
body {color: #737373; font-size: 10px; font-family: verdana;}

textarea,input,select {
background-color: #FDFBFB;
border: 1px solid #BBBBBB;
padding: 2px;
margin: 1px;
font-size: 14px;
color: #808080;
}

a, a:link, a:visited, a:active { color: #AAAAAA; text-decoration: none; font-size: 10px; }
a:hover { border-bottom: 1px dotted #c1c1c1; color: #AAAAAA; }
img {border: none;}
td { font-size: 14px; color: #7A7A7A; }
</style>

</head>

<body>
$(if chap-id)
	<form name="sendin" action="$(link-login-only)" method="post">
		<input type="hidden" name="username" />
		<input type="hidden" name="password" />
		<input type="hidden" name="dst" value="$(link-orig)" />
		<input type="hidden" name="popup" value="true" />
	</form>
	
	<script type="text/javascript" src="/md5.js"></script>
	<script type="text/javascript">
	<!--
	    function doLogin() {
		document.sendin.username.value = document.login.username.value;
		document.sendin.password.value = hexMD5('$(chap-id)' + document.login.password.value + '$(chap-challenge)');
		document.sendin.submit();
		return false;
	    }
	//-->
	</script>
$(endif)
.
.
.
.

<form name="login" action="$(link-login-only)" method="post"
					    $(if chap-id) onSubmit="return doLogin()" $(endif)>
						<input type="hidden" name="dst" value="$(link-orig)" />
						<input type="hidden" name="popup" value="true" />
						<input type="hidden" name="username" value="guestuser">

<td align="right">Enter password =></td>
										<td><input name="password" type="password" style="width: 150px"/></td>
</tr>
								<tr>
										<td>Click Link =></td>
										<td><input style="color:#2A7FFF; font-size: 14px" type="submit" value="By CLICKING THIS LINK YOU AGREE TO THE ABOVE TERMS AND CONDITIONS FOR INTERNET ACCESS" /></td>
								</tr>
							</table>
					</form>
What must change to include the password so end user only has to click on submit button and doesn't see the table data which tells the user to enter the password?

Thanks
 
User avatar
rcourtney
Frequent Visitor
Frequent Visitor
Posts: 61
Joined: Wed May 22, 2013 10:55 pm

Re: Hotspot login with password included when submit is clicked

Sat Sep 24, 2016 11:27 pm

Try this:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/>
<style type="text/css">
body {color: #737373; font-size: 10px; font-family: verdana;}

textarea,input,select {
background-color: #FDFBFB;
border: 1px solid #BBBBBB;
padding: 2px;
margin: 1px;
font-size: 14px;
color: #808080;
}

a, a:link, a:visited, a:active { color: #AAAAAA; text-decoration: none; font-size: 10px; }
a:hover { border-bottom: 1px dotted #c1c1c1; color: #AAAAAA; }
img {border: none;}
td { font-size: 14px; color: #7A7A7A; }
</style>

</head>

<body>
$(if chap-id)
   <form name="sendin" action="$(link-login-only)" method="post">
      <input type="hidden" name="username" />
      <input type="hidden" name="password" />
      <input type="hidden" name="dst" value="$(link-orig)" />
      <input type="hidden" name="popup" value="true" />
   </form>
   
   <script type="text/javascript" src="/md5.js"></script>
   <script type="text/javascript">
   <!--
       function doLogin() {
      document.sendin.username.value = document.login.username.value;
      document.sendin.password.value = hexMD5('$(chap-id)' + document.login.password.value + '$(chap-challenge)');
      document.sendin.submit();
      return false;
       }
   //-->
   </script>
$(endif)
.
.
.
.

<form name="login" action="$(link-login-only)" method="post"
                   $(if chap-id) onSubmit="return doLogin()" $(endif)>
                  <input type="hidden" name="dst" value="$(link-orig)" />
                  <input type="hidden" name="popup" value="true" />
                  <input type="hidden" name="username" value="guestuser">
                  <input type="hidden" name="password" value="password">
                        <tr>
                              <td>Click Link =></td>
                              <td><input style="color:#2A7FFF; font-size: 14px" type="submit" value="By CLICKING THIS LINK YOU AGREE TO THE ABOVE TERMS AND CONDITIONS FOR INTERNET ACCESS" /></td>
                        </tr>
</form>
 
pauljames
just joined
Topic Author
Posts: 6
Joined: Sun Aug 21, 2016 3:10 pm

Re: Hotspot login with password included when submit is clicked

Wed Sep 28, 2016 2:42 pm

Hi rcourtney, thanks. Tried it locally and it worked just fine.
Thanks for your help!