1
0
mirror of https://github.com/bitwarden/web synced 2025-12-31 23:53:13 +00:00

change email/password adjustments

This commit is contained in:
Kyle Spearrin
2017-04-17 14:53:26 -04:00
parent aa7a3c442c
commit bc431b896b
4 changed files with 35 additions and 5 deletions

View File

@@ -39,13 +39,23 @@
reencryptedFolders = cipherService.encryptFolders(unencryptedFolders, _newKey);
}).$promise;
var privateKey = cryptoService.getPrivateKey('raw'),
reencryptedPrivateKey = null;
if (privateKey) {
reencryptedPrivateKey = cryptoService.encrypt(privateKey, _newKey, 'raw');
}
$q.all([loginsPromise, foldersPromise]).then(function () {
var request = {
token: model.token,
newEmail: model.newEmail.toLowerCase(),
masterPasswordHash: _masterPasswordHash,
newMasterPasswordHash: _newMasterPasswordHash,
ciphers: reencryptedLogins.concat(reencryptedFolders)
data: {
ciphers: reencryptedLogins,
folders: reencryptedFolders,
privateKey: reencryptedPrivateKey
}
};
$scope.confirmPromise = apiService.accounts.email(request, function () {

View File

@@ -39,11 +39,21 @@
reencryptedFolders = cipherService.encryptFolders(unencryptedFolders, newKey);
}).$promise;
var privateKey = cryptoService.getPrivateKey('raw'),
reencryptedPrivateKey = null;
if (privateKey) {
reencryptedPrivateKey = cryptoService.encrypt(privateKey, newKey, 'raw');
}
$q.all([loginsPromise, foldersPromise]).then(function () {
var request = {
masterPasswordHash: cryptoService.hashPassword(model.masterPassword),
newMasterPasswordHash: cryptoService.hashPassword(model.newMasterPassword, newKey),
ciphers: reencryptedLogins.concat(reencryptedFolders)
data: {
ciphers: reencryptedLogins,
folders: reencryptedFolders,
privateKey: reencryptedPrivateKey
}
};
$scope.savePromise = apiService.accounts.putPassword(request, function () {