v1.0.8b
- Bug fixed: initDB not upgrading correctly. - Added message to remind the user to secure the private key with password. - Darkened (color) the warning popup.
This commit is contained in:
parent
1764a90912
commit
326d4bc589
38
index.html
38
index.html
@ -1075,6 +1075,7 @@
|
||||
</script>
|
||||
<script id="onLoadStartUp">
|
||||
function onLoadStartUp() {
|
||||
privKeyNotSecured = true;
|
||||
//display loading screen
|
||||
document.getElementById("loading-screen").classList.remove("hide")
|
||||
document.getElementById("sign-in-box").classList.add("hide")
|
||||
@ -1112,6 +1113,7 @@
|
||||
signInBox["key"].setAttribute("placeholder", "Password")
|
||||
signInBox["guest-login"].classList.add("hide");
|
||||
signInBox["remove-account"].classList.remove("hide");
|
||||
privKeyNotSecured = false;
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -1413,7 +1415,7 @@
|
||||
|
||||
document.forms["sign-in-box"]["remove-account"].addEventListener('click', function (e) {
|
||||
getConfirmation('Remove Account?',
|
||||
'**Remember to store your PRIVATE-KEY**\*Private-Key will be needed to signIn again*\nAre you sure you want to remove account?',
|
||||
'**Remember to store your PRIVATE-KEY**\n*Private-Key will be needed to signIn again*\nAre you sure you want to remove account?',
|
||||
"Remove").then(result => {
|
||||
floDapps.logout().then(result => {
|
||||
showMessage("Removed Account")
|
||||
@ -1424,9 +1426,10 @@
|
||||
|
||||
document.getElementById("secure-key").addEventListener('click', function (e) {
|
||||
getPromptInput("Secure Private-Key", 'Enter Password', false).then(value => {
|
||||
floDapps.securePrivKey(value)
|
||||
.then(result => showMessage("Private Key secured"))
|
||||
.catch(error => showMessage("Securing Failed", "error", error))
|
||||
floDapps.securePrivKey(value).then(result => {
|
||||
privKeyNotSecured = false;
|
||||
showMessage("Private Key secured");
|
||||
}).catch(error => showMessage("Securing Failed", "error", error))
|
||||
}).catch(error => {})
|
||||
});
|
||||
|
||||
@ -1459,6 +1462,8 @@
|
||||
showMessage(
|
||||
`${Object.keys(data.messages).length} New Messages And ${Object.keys(data.mails).length} New Mails`
|
||||
)
|
||||
if(privKeyNotSecured)
|
||||
setTimeout( () => showMessage("Private key is not secured with password. Remember to secure the private key in settings", "warn"), 5000)
|
||||
}).catch(error => showMessage(error, "error"))
|
||||
.finally(_ => this.classList.remove("active"))
|
||||
})
|
||||
@ -1635,7 +1640,7 @@
|
||||
let bg = {
|
||||
normal: '#00C853',
|
||||
error: '#D32F2F',
|
||||
warn: '#FFCC00',
|
||||
warn: '#FFAA00',
|
||||
cool: '#08B6CE'
|
||||
}
|
||||
let banner = document.getElementById('show-message')
|
||||
@ -10002,33 +10007,40 @@ Bitcoin.Util = {
|
||||
this.dbName = dbName;
|
||||
},
|
||||
|
||||
initDB: function (dbName, objectStores = {}) {
|
||||
initDB: function (dbName, objectStores = {}, version = null, removeStores = []) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.dbName = this.dbName || dbName;
|
||||
var idb = indexedDB.open(dbName);
|
||||
var idb = version ? indexedDB.open(dbName, version) : indexedDB.open(dbName);
|
||||
idb.onerror = (event) => {
|
||||
reject("Error in opening IndexedDB!");
|
||||
};
|
||||
idb.onupgradeneeded = (event) => {
|
||||
var db = event.target.result;
|
||||
for (obs in objectStores) {
|
||||
for (let obs in objectStores) {
|
||||
var objectStore = db.createObjectStore(obs, objectStores[obs].options ||
|
||||
{});
|
||||
if (objectStores[obs].indexes && typeof objectStores[obs].indexes ===
|
||||
'object')
|
||||
for (i in objectStores[obs].indexes)
|
||||
for (let i in objectStores[obs].indexes)
|
||||
objectStore.createIndex(i, i, objectStores[obs].indexes[i] || {});
|
||||
}
|
||||
if (version)
|
||||
removeStores.forEach(obs => db.deleteObjectStore(obs));
|
||||
}
|
||||
idb.onsuccess = (event) => {
|
||||
var db = event.target.result;
|
||||
if (JSON.stringify(Object.values(db.objectStoreNames).sort()) === JSON
|
||||
.stringify(Object.keys(
|
||||
objectStores).sort()))
|
||||
.stringify(Object.keys(objectStores).sort()))
|
||||
resolve("Initiated IndexedDB");
|
||||
else {
|
||||
Object.values(db.objectStoreNames).forEach(obs => delete objectStores[obs])
|
||||
this.initDB(dbName, objectStores, db.version + 1)
|
||||
let removeObs = [];
|
||||
Object.values(db.objectStoreNames).forEach(obs => {
|
||||
if (obs in objectStores)
|
||||
delete objectStores[obs]
|
||||
else
|
||||
removeObs.push(obs)
|
||||
})
|
||||
this.initDB(dbName, objectStores, db.version + 1, removeObs)
|
||||
.then(result => resolve(result))
|
||||
.catch(error => reject(error))
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user