From 0da43c45206e62c27b4487514258333974ec54d1 Mon Sep 17 00:00:00 2001 From: kanadeko Date: Mon, 16 Jan 2017 06:26:43 -0300 Subject: Login screen on dashboard --- public/css/style.css | 16 +++++++++++++++- public/js/panel.js | 24 +++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) (limited to 'public') diff --git a/public/css/style.css b/public/css/style.css index fcd4923..ad67545 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -75,4 +75,18 @@ img.logo { height: 200px; margin-top: 20px; } -webkit-transform: scale(1); transform: scale(1); } -} \ No newline at end of file +} + +/* ------------------ + PANEL +------------------ */ + +section#dashboard { display: none } +section#auth input, section#auth a { + border-left: 0px; + border-top: 0px; + border-right: 0px; + border-radius: 0px; + background: rgba(0, 0, 0, 0); + box-shadow: 0 0 0; +} 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(); -- cgit v1.2.3