Home
Help
Search
Login
Register
OPNsense Forum
»
Archive
»
16.1 Legacy Series
»
Captive Portal Template
« previous
next »
Print
Pages: [
1
]
Author
Topic: Captive Portal Template (Read 10872 times)
troppodel
Newbie
Posts: 2
Karma: 0
Captive Portal Template
«
on:
February 26, 2016, 12:42:49 pm »
Hi there
I need to use captive portal with vouchers auth
sorry for my question but My template test no work with vouchers mode
I tried to search by internet but not found info.
here tries to modify the default template index file:
changed dat user is #inputVoucher with new function
$("#signinvoucher").click(function (event) {
event.preventDefault();
// hide alerts
$("#alertMSG").addClass("hidden");
// try to login
$.ajax({
type: "POST",
url: "/api/captiveportal/access/logon/" + zoneid + "/",
dataType:"json",
data:{ user: $("#inputVoucher").val() }
}).done(function(data) {
// redirect on successful login
if (data['clientState'] == 'AUTHORIZED') {
if (getURLparams()['redirurl'] != undefined) {
window.location = 'http://'+getURLparams()['redirurl']+'?refresh';
} else {
// no target, reload page
window.location.reload();
}
} else {
$("#inputVoucher").val("");
$("#errorMSGtext").html("authentication failed");
$("#alertMSG").removeClass("hidden");
}
}).fail(function(){
$("#errorMSGtext").html("unable to connect to authentication server");
$("#alertMSG").removeClass("hidden");
});
});
MODIFIED THE FORM:
<div id="login_password" class="hidden">
<form class="form-signin">
<h2 class="form-signin-heading">Please sign in</h2>
<label for="inputVoucher" class="sr-only">Voucher</label>
<input type="text" id="inputVoucher" class="form-control" placeholder="Voucher" required autofocus>
<button class="btn btn-primary btn-block" id="signinvoucher" type="button">Sign in</button>
</form>
</div>
ABOVE ERROR AUTHENTICATION
TRIED OTHER TEMPLATE WITH form method="post":
<form method="post" action="$PORTAL_ACTION$" class="login" >
<img src="captiveportal-wlan.png" text-align="center"></br></br>
<h1>User Authentication</h1>
<p class="login-p">Enter your valid Username and Password OR Vouchers</p>
<p class="login-p">Inserisci un utente e una password valida</br>OPPURE </br>IL CODICE VOUCHER</p>
<input type="text" name="auth_user" class="login-input" placeholder="Username (Utente)" autofocus>
<input type="password" name="auth_pass" class="login-input" placeholder="Password (Password)">
<p class="login-p"><font color="#ff6600"><big><big><b>OR</b></big></big></font></p></br>
<input type="text" name="auth_voucher" class="login-inputv" placeholder="Voucher Code (Codice Voucher)" autofocus>
<input name="redirurl" value="$PORTAL_REDIRURL$" type="hidden">
</br>
ERROR NOT FOUND PAGE PORTAL_ACTION
Someone have a work templates with voucher mode?
Someone can support me?
Thanks
Regards
Logged
DokuKäfer
Jr. Member
Posts: 83
Karma: 15
Re: Captive Portal Template
«
Reply #1 on:
February 26, 2016, 01:35:17 pm »
Take a look on the template from user hollsten
https://forum.opnsense.org/index.php?topic=2196.0
(german thread)
«
Last Edit: February 26, 2016, 01:37:02 pm by DokuKäfer
»
Logged
troppodel
Newbie
Posts: 2
Karma: 0
Re: Captive Portal Template
«
Reply #2 on:
February 26, 2016, 01:49:38 pm »
Thanks but if you see this template use only username and password
no voucher
Logged
DokuKäfer
Jr. Member
Posts: 83
Karma: 15
Re: Captive Portal Template
«
Reply #3 on:
February 26, 2016, 01:57:06 pm »
Yes thats correct.
Only
Voucher code is not supported in the new Captive Portal (version 16).
https://github.com/opnsense/core/issues/688
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
Archive
»
16.1 Legacy Series
»
Captive Portal Template