aboutsummaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorkanadeko <[email protected]>2017-01-16 06:26:43 -0300
committerkanadeko <[email protected]>2017-01-16 06:26:43 -0300
commit0da43c45206e62c27b4487514258333974ec54d1 (patch)
tree95c2968e96f37a3997b594a110257d47b325bf19 /public/js
parentFix on token check (diff)
downloadhost.fuwn.me-0da43c45206e62c27b4487514258333974ec54d1.tar.xz
host.fuwn.me-0da43c45206e62c27b4487514258333974ec54d1.zip
Login screen on dashboard
Diffstat (limited to 'public/js')
-rw-r--r--public/js/panel.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/public/js/panel.js b/public/js/panel.js
index bc10b0b..ed1bea0 100644
--- a/public/js/panel.js
+++ b/public/js/panel.js
@@ -1,12 +1,34 @@
window.onload = function () {
- if(!localStorage.token)
+ if(!localStorage.admintoken){
+ askForToken();
return;
+ }
+ var dashboard = document.getElementById('dashboard');
var page = document.getElementById('page');
+ dashboard.style.display = 'block';
prepareMenu();
+ function askForToken(){
+ document.getElementById('tokenSubmit').addEventListener('click', function(){
+ checkToken();
+ });
+
+ function checkToken(){
+ var xhr = new XMLHttpRequest();
+
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == XMLHttpRequest.DONE) {
+ // xhr.responseText
+ }
+ }
+ xhr.open('POST', '/api/info', true);
+ xhr.send(null);
+ }
+ }
+
function prepareMenu(){
document.getElementById('itemUploads').addEventListener('click', function(){
getUploads();