From: hackbard Date: Wed, 22 Jun 2016 20:44:30 +0000 (+0200) Subject: passwd verification X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=outofuni%2Fstafforg.git passwd verification --- diff --git a/app/www/css/index.css b/app/www/css/index.css index 12ab07a..cc71d7e 100644 --- a/app/www/css/index.css +++ b/app/www/css/index.css @@ -81,11 +81,13 @@ body { text-align: center; } -#adminmain { +#adminauth { display: none; + color: black; + text-align: center; } -#adminauth { +#adminmain { display: none; } diff --git a/app/www/index.html b/app/www/index.html index 55c85d2..5b1e761 100644 --- a/app/www/index.html +++ b/app/www/index.html @@ -98,6 +98,12 @@ id=adminpw2 required>
+
+ Enter admin password +

+
diff --git a/app/www/js/index.js b/app/www/js/index.js index 446c060..552601a 100644 --- a/app/www/js/index.js +++ b/app/www/js/index.js @@ -36,6 +36,9 @@ var stafforg = { cl("starting stafforg app ..."); // idb + //idb.name='stafforg'; + //idb.del(); + //return; var stores={ 'admin': db_admin_store } @@ -96,6 +99,15 @@ var stafforg = { }); } else { + $('#adminset').css('display','none'); + $('#adminauth').css('display','block'); + $('#adminmain').css('display','none'); + $('#adminpw').each(function() { + cl("yep ..."); + }); + $('#adminpw').keyup(function() { + stafforg.verifypw(item.passwd); + }); } }); }, @@ -105,7 +117,7 @@ var stafforg = { if(pw1=='') { $('#adminpw1').css('border-color','red'); - return + return; } else { $('#adminpw1').css('border-color','black'); @@ -113,17 +125,36 @@ var stafforg = { if(pw2=='') { $('#adminpw2').css('border-color','grey'); - return + return; } if(pw1!=pw2) { $('#adminpw2').css('border-color','red'); - return + return; } if(pw1==pw2) { - alert("yep, i will store this password!"); + var nitem={ + passwd: pw1 + }; + idb.update_store_item('admin',1,nitem,function() { + cl("password '"+nitem.passwd+"' set!"); + setTimeout(function() { + stafforg.admin_init(); + },200); + }); + return; + } + }, + verifypw: function(passwd) { + cl("verify called!"); + if($('#adminpw').val()!=passwd) { + $('#adminpw').css('border-color','red'); + } + else { + alert("Thanks!"); } + return; } };