mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 17:44:41 +00:00
(captiveportal, new) work in progress, html login page
This commit is contained in:
parent
b091c0fb97
commit
4deca554ad
@ -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");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user