diff --git a/app.js b/app.js index 77d5078..6b26c60 100644 --- a/app.js +++ b/app.js @@ -78,6 +78,18 @@ function takeVotingRights(){ }); } +function nullPrezenta(){ + Object.keys(credentials).forEach(function(key) { + credentials[key].present = 0; + }); +} + +function nullLogStatus(){ + Object.keys(credentials).forEach(function(key) { + credentials[key].loggedIn = 0; + }); +} + app.get('/', (request, response) => { @@ -393,6 +405,20 @@ app.get('/admindo', (request, response) => { report("++ PREZENTI: " + prezenti.toString() + " ++"); report("------------PREZENTA------------"); } + if(request.query.do === 'reset'){ + + takeVotingRights(); + nullLogStatus(); + nullPrezenta(); + + activity = 'null'; + + logString = ''; + + response.redirect('/logout'); + response.end(); + return; + } } response.redirect('/admin'); diff --git a/webFiles/adminpanel.html b/webFiles/adminpanel.html index 72defd4..4cd9a08 100644 --- a/webFiles/adminpanel.html +++ b/webFiles/adminpanel.html @@ -36,6 +36,10 @@ + +
RESET
+ +