X-Git-Url: https://hackdaworld.org/gitweb/?p=outofuni%2Fstafforg.git;a=blobdiff_plain;f=app%2Fwww%2Fjs%2Findex.js;fp=app%2Fwww%2Fjs%2Findex.js;h=552601ad4396e8828b05e83e84eba23d1ec240ae;hp=446c060c8b63d93a13194106fd5598b77210e75c;hb=f55778f686268ad40f9e235bb6c9dae0a1c2ed54;hpb=714e3dd465ec416d16b417f208d1ecc241c8f70a 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; } };