From 8e4c19d29c262e1a7bf790a61ea842d77a34af91 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Fri, 26 Feb 2016 16:14:09 +0100 Subject: [PATCH] fix up recuweb password popup weirdness, now give nice warning on wrong password. Still open: do we need the api-key password? --- pdns/recursordist/html/index.html | 5 ++++- pdns/recursordist/html/local.js | 23 +++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/pdns/recursordist/html/index.html b/pdns/recursordist/html/index.html index a513ccd0a..c38cf75b4 100644 --- a/pdns/recursordist/html/index.html +++ b/pdns/recursordist/html/index.html @@ -42,7 +42,10 @@
-
Password:
+
Password: + + +

diff --git a/pdns/recursordist/html/local.js b/pdns/recursordist/html/local.js index 6818f1551..cd7bc658a 100644 --- a/pdns/recursordist/html/local.js +++ b/pdns/recursordist/html/local.js @@ -9,6 +9,7 @@ $(document).ready(function() { var password=$("#password").val(); $("#password").change(function(e) { password=$("#password").val(); + update(); }); var qpsgraph = new Rickshaw.Graph( { @@ -55,7 +56,7 @@ $(document).ready(function() { function updateRingBuffers() { var filtered=$("#filter1").is(':checked') - var qstring='/jsonstat?api-key='+password+'&command=get-query-ring&name=queries&callback=?'; + var qstring='/jsonstat?api-key='+password+'&command=get-query-ring&name=queries'; if(filtered) qstring=qstring+"&public-filtered=1"; @@ -83,7 +84,7 @@ $(document).ready(function() { }); filtered=$("#filter2").is(':checked') - qstring='/jsonstat?api-key='+password+'&command=get-query-ring&name=servfail-queries&callback=?'; + qstring='/jsonstat?api-key='+password+'&command=get-query-ring&name=servfail-queries'; if(filtered) qstring=qstring+"&public-filtered=1"; @@ -108,7 +109,7 @@ $(document).ready(function() { }); - $.getJSON('/jsonstat?api-key='+password+'&command=get-remote-ring&name=remotes&callback=?', + $.getJSON('/jsonstat?api-key='+password+'&command=get-remote-ring&name=remotes', function(data) { var bouw=""; var num=0, total=0, rest=0; @@ -126,7 +127,7 @@ $(document).ready(function() { }); - $.getJSON('/jsonstat?api-key='+password+'&command=get-remote-ring&name=servfail-remotes&callback=?', + $.getJSON('/jsonstat?api-key='+password+'&command=get-remote-ring&name=servfail-remotes', function(data) { var bouw="
NumberRemote
"; var num=0, total=0, rest=0; @@ -149,12 +150,13 @@ $(document).ready(function() { function update() { - $.ajax({ - url: '/api/v1/servers/localhost/statistics?api-key='+password+'&callback=?', + url: '/api/v1/servers/localhost/statistics?api-key='+password, type: 'GET', - dataType: 'jsonp', + dataType: 'json', success: function(adata, x, y) { + $("#connection-status").hide(); + $("#connection-error").html(""); var data={}; $.each(adata, function(key, val) { data[val.name]=val.value; @@ -189,8 +191,9 @@ $(document).ready(function() { gdata=data; }, - error: function() { - alert('boo!'); + error: function(o) { + $("#connection-status").show(); + $("#connection-error").html(o.status+" "+o.statusText); }, beforeSend: function(xhr) { xhr.setRequestHeader('X-API-Key', 'changeme'); @@ -200,7 +203,7 @@ $(document).ready(function() { } }); - $.ajax({ url: '/api/v1/servers/localhost?api-key='+password+'&callback=?', type: 'GET', dataType: 'jsonp', + $.ajax({ url: '/api/v1/servers/localhost?api-key='+password, type: 'GET', dataType: 'json', success: function(data) { $("#version").text("PowerDNS "+data["daemon_type"]+" "+data["version"]); } -- 2.40.0
NumberServfail Remote