1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 18:53:29 +00:00

two factor page cleanup

This commit is contained in:
Kyle Spearrin
2017-06-26 22:24:10 -04:00
parent 64784d0e36
commit 1d102cad93
11 changed files with 197 additions and 64 deletions

View File

@@ -102,6 +102,46 @@ function initTokenService() {
});
};
TokenService.prototype.setTwoFactorToken = function (token, email, callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
var obj = {};
obj['twoFactorToken_' + email] = token;
chrome.storage.local.set(obj, function () {
callback();
});
};
TokenService.prototype.getTwoFactorToken = function (email, callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
var prop = 'twoFactorToken_' + email;
chrome.storage.local.get(prop, function (obj) {
if (obj && obj[prop]) {
callback(obj[prop]);
return;
}
return callback(null);
});
};
TokenService.prototype.clearTwoFactorToken = function (email, callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
chrome.storage.local.remove('twoFactorToken_' + email, function () {
callback();
});
};
TokenService.prototype.clearAuthBearer = function (callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';