]> hackdaworld.org Git - outofuni/stafforg.git/commitdiff
passwd verification master
authorhackbard <hackbard@hackdaworld.org>
Wed, 22 Jun 2016 20:44:30 +0000 (22:44 +0200)
committerhackbard <hackbard@hackdaworld.org>
Wed, 22 Jun 2016 20:44:30 +0000 (22:44 +0200)
app/www/css/index.css
app/www/index.html
app/www/js/index.js

index 12ab07ae0b20ad692a7f5f6b5ac299f1d2327cc6..cc71d7e15c742a6b702764921049e3359e9508f2 100644 (file)
@@ -81,11 +81,13 @@ body {
        text-align: center;
 }
 
        text-align: center;
 }
 
-#adminmain {
+#adminauth {
        display: none;
        display: none;
+       color: black;
+       text-align: center;
 }
 
 }
 
-#adminauth {
+#adminmain {
        display: none;
 }
 
        display: none;
 }
 
index 55c85d28640e9cae52e964e69e510402ffe812f4..5b1e761479d5d1ae7b6628c001d24200399232e6 100644 (file)
                                       id=adminpw2 required>
                        </div>
                        <div id=adminauth class=main>
                                       id=adminpw2 required>
                        </div>
                        <div id=adminauth class=main>
+                               <br>
+                               Enter admin password
+                               <br><br>
+                               <input type=password
+                                      placeholder="Password"
+                                      id=adminpw required>
                        </div>
                        <div id=adminmain class=main>
                        </div>
                        </div>
                        <div id=adminmain class=main>
                        </div>
index 446c060c8b63d93a13194106fd5598b77210e75c..552601ad4396e8828b05e83e84eba23d1ec240ae 100644 (file)
@@ -36,6 +36,9 @@ var stafforg = {
                cl("starting stafforg app ...");
 
                // idb
                cl("starting stafforg app ...");
 
                // idb
+               //idb.name='stafforg';
+               //idb.del();
+               //return;
                var stores={
                        'admin': db_admin_store
                }
                var stores={
                        'admin': db_admin_store
                }
@@ -96,6 +99,15 @@ var stafforg = {
                                });
                        }
                        else {
                                });
                        }
                        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');
 
                if(pw1=='') {
                        $('#adminpw1').css('border-color','red');
-                       return
+                       return;
                }
                else {
                        $('#adminpw1').css('border-color','black');
                }
                else {
                        $('#adminpw1').css('border-color','black');
@@ -113,17 +125,36 @@ var stafforg = {
 
                if(pw2=='') {
                        $('#adminpw2').css('border-color','grey');
 
                if(pw2=='') {
                        $('#adminpw2').css('border-color','grey');
-                       return
+                       return;
                }
 
                if(pw1!=pw2) {
                        $('#adminpw2').css('border-color','red');
                }
 
                if(pw1!=pw2) {
                        $('#adminpw2').css('border-color','red');
-                       return
+                       return;
                }
 
                if(pw1==pw2) {
                }
 
                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;
        }
 };
 
        }
 };