User Tools

Site Tools


sample_code:passwordvault

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sample_code:passwordvault [2022/07/24 21:50]
al4he6 database path added, to make it work as APK
sample_code:passwordvault [2022/07/26 11:37] (current)
al4he6
Line 11: Line 11:
 Requires the Biometric plugin (or you could comment out that code)\\ Requires the Biometric plugin (or you could comment out that code)\\
    
-<code>+<file js passwordvault.js>
 app.LoadPlugin( "Biometric" ) app.LoadPlugin( "Biometric" )
 var mpw  // plaintext master password var mpw  // plaintext master password
Line 63: Line 63:
 } // fn } // fn
 function opendb () { function opendb () {
 +    add = app.AddButton(lay,"[fa-plus-square-o] Add",null,null,"fontawesome")
 +    add.SetOnTouch(insert)
 +    lst = app.AddList(lay,"",0.8)
 +    lst.SetTextSize2(18,"px")
 +    lst.SetOnTouch(show)
 +
 //    db = app.OpenDatabase( "Vault" ) // does not work as APK   //    db = app.OpenDatabase( "Vault" ) // does not work as APK  
-    db = app.OpenDatabase(app.GetSpecialFolder("Downloads")+"/Vault" )   +    db = app.OpenDatabase(app.GetPrivateFolder("Downloads")+"/Vault" )   
-    db.ExecuteSql("CREATE TABLE IF NOT EXISTS passwords (site text primary key, epw text)")  +       db.ExecuteSql("CREATE TABLE IF NOT EXISTS passwords (site text primary key, epw text)")  
 //db.ExecuteSql("DELETE FROM passwords",[],null,delError) // testing //db.ExecuteSql("DELETE FROM passwords",[],null,delError) // testing
 //epw = crpt.Encrypt("home",mpw+salt) // testing //epw = crpt.Encrypt("home",mpw+salt) // testing
 //db.ExecuteSql("INSERT INTO passwords (site, epw) VALUES (?,?)", ["home", epw], null, insError ) // testing  //db.ExecuteSql("INSERT INTO passwords (site, epw) VALUES (?,?)", ["home", epw], null, insError ) // testing 
     db.ExecuteSql( "select * from passwords order by site;", [], display )      db.ExecuteSql( "select * from passwords order by site;", [], display ) 
-    app.EnableBackKey(false) // close database if app closed+        app.EnableBackKey(false) // close database if app closed
 } // fn } // fn
 function display(results) { function display(results) {
-    add = app.AddButton(lay,"[fa-plus-square-o] Add",null,null,"fontawesome") 
-    add.SetOnTouch(insert) 
     var str = "";       var str = "";  
     for (var i = 0; i < results.rows.length; i++ ) {     for (var i = 0; i < results.rows.length; i++ ) {
Line 84: Line 88:
         str += site+":"+pw+":"            str += site+":"+pw+":"   
     } // for       } // for  
-    lst = app.AddList(lay,str,0.8) +    lst.SetList(str)
-    lst.SetTextSize2(18,"px"+
-    lst.SetOnTouch(show)+
 } // fn } // fn
 function insert() { function insert() {
Line 167: Line 169:
     app.Exit()     app.Exit()
 } }
- +</file>
-</code>+
sample_code/passwordvault.1658699408.txt.gz · Last modified: 2022/07/24 21:50 by al4he6