Commit 4deca554 authored by Ad Schellevis's avatar Ad Schellevis

(captiveportal, new) work in progress, html login page

parent b091c0fb
......@@ -18,6 +18,19 @@
<script type="text/javascript" src="/js/jquery-1.11.2.min.js"></script>
<script>
function getURLparams()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
$( document ).ready(function() {
/**
* logon action
......@@ -33,7 +46,14 @@
dataType:"json",
data:{ user: $("#inputUsername").val(), password: $("#inputPassword").val() }
}).done(function(data) {
alert(JSON.stringify(data));
// redirect on successful login
if (data['clientState'] == 'AUTHORIZED') {
window.location = 'http://'+getURLparams()['redirurl']+'?refresh';
} else {
// todo implement alert for login failure
$("#errorMSGtext").html("authentication failed");
$("#alertMSG").removeClass("hidden");
}
}).fail(function(){
$("#errorMSGtext").html("unable to connect to authentication server");
$("#alertMSG").removeClass("hidden");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment