1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

convert token service to ts

This commit is contained in:
Kyle Spearrin
2017-11-02 20:50:00 -04:00
parent bf38ca9578
commit 9f9e3245de
7 changed files with 23 additions and 277 deletions

View File

@@ -40,26 +40,26 @@ angular
}
if (response.twoFactorToken) {
tokenService.setTwoFactorToken(response.twoFactorToken, email, function () { });
tokenService.setTwoFactorToken(response.twoFactorToken, email);
}
tokenService.setTokens(response.accessToken, response.refreshToken, function () {
cryptoService.setKey(key).then(function () {
return cryptoService.setKeyHash(hashedPassword);
}).then(function () {
userService.setUserIdAndEmail(tokenService.getUserId(), tokenService.getEmail(),
function () {
cryptoService.setEncKey(response.key).then(function () {
return cryptoService.setEncPrivateKey(response.privateKey);
}).then(function () {
chrome.runtime.sendMessage({ command: 'loggedIn' });
deferred.resolve({
twoFactor: false,
twoFactorProviders: null
});
tokenService.setTokens(response.accessToken, response.refreshToken).then(function () {
return cryptoService.setKey(key);
}).then(function () {
return cryptoService.setKeyHash(hashedPassword);
}).then(function () {
userService.setUserIdAndEmail(tokenService.getUserId(), tokenService.getEmail(),
function () {
cryptoService.setEncKey(response.key).then(function () {
return cryptoService.setEncPrivateKey(response.privateKey);
}).then(function () {
chrome.runtime.sendMessage({ command: 'loggedIn' });
deferred.resolve({
twoFactor: false,
twoFactorProviders: null
});
});
});
});
});
}, function (providers) {
// two factor required