delete items on signout
This commit is contained in:
@@ -88,8 +88,9 @@ angular.module('app.frontend')
|
|||||||
|
|
||||||
this.signOutPressed = function() {
|
this.signOutPressed = function() {
|
||||||
this.showAccountMenu = false;
|
this.showAccountMenu = false;
|
||||||
apiController.signout();
|
apiController.signout(function(){
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.submitPasswordChange = function() {
|
this.submitPasswordChange = function() {
|
||||||
|
|||||||
@@ -571,8 +571,11 @@ angular.module('app.frontend')
|
|||||||
localStorage.setItem('mk', mk);
|
localStorage.setItem('mk', mk);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.signout = function() {
|
this.signout = function(callback) {
|
||||||
localStorage.clear();
|
dbManager.clearAllItems(function(){
|
||||||
|
localStorage.clear();
|
||||||
|
callback();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.encryptSingleItem = function(item, masterKey) {
|
this.encryptSingleItem = function(item, masterKey) {
|
||||||
|
|||||||
@@ -115,6 +115,16 @@ class DBManager {
|
|||||||
};
|
};
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearAllItems(callback) {
|
||||||
|
this.openDatabase((db) => {
|
||||||
|
var request = db.transaction("items", "readwrite").objectStore("items").clear();
|
||||||
|
request.onsuccess = function(event) {
|
||||||
|
console.log("Successfully cleared items");
|
||||||
|
callback();
|
||||||
|
};
|
||||||
|
}, null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
angular.module('app.frontend').service('dbManager', DBManager);
|
angular.module('app.frontend').service('dbManager', DBManager);
|
||||||
|
|||||||
25
vendor/assets/javascripts/transpiled.js
vendored
25
vendor/assets/javascripts/transpiled.js
vendored
@@ -793,8 +793,9 @@ angular.module('app.frontend').controller('BaseCtrl', BaseCtrl);
|
|||||||
|
|
||||||
this.signOutPressed = function () {
|
this.signOutPressed = function () {
|
||||||
this.showAccountMenu = false;
|
this.showAccountMenu = false;
|
||||||
apiController.signout();
|
apiController.signout(function () {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.submitPasswordChange = function () {
|
this.submitPasswordChange = function () {
|
||||||
@@ -957,7 +958,7 @@ angular.module('app.frontend').controller('BaseCtrl', BaseCtrl);
|
|||||||
// refresh every 30s
|
// refresh every 30s
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
apiController.sync(null);
|
apiController.sync(null);
|
||||||
}, 30000);
|
}, 2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.allTag = new Tag({ all: true });
|
$scope.allTag = new Tag({ all: true });
|
||||||
@@ -2487,8 +2488,11 @@ var Tag = function (_Item3) {
|
|||||||
localStorage.setItem('mk', mk);
|
localStorage.setItem('mk', mk);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.signout = function () {
|
this.signout = function (callback) {
|
||||||
localStorage.clear();
|
dbManager.clearAllItems(function () {
|
||||||
|
localStorage.clear();
|
||||||
|
callback();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.encryptSingleItem = function (item, masterKey) {
|
this.encryptSingleItem = function (item, masterKey) {
|
||||||
@@ -2711,6 +2715,17 @@ var DBManager = function () {
|
|||||||
};
|
};
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: 'clearAllItems',
|
||||||
|
value: function clearAllItems(callback) {
|
||||||
|
this.openDatabase(function (db) {
|
||||||
|
var request = db.transaction("items", "readwrite").objectStore("items").clear();
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
console.log("Successfully cleared items");
|
||||||
|
callback();
|
||||||
|
};
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
return DBManager;
|
return DBManager;
|
||||||
|
|||||||
2
vendor/assets/javascripts/transpiled.js.map
vendored
2
vendor/assets/javascripts/transpiled.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user