1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

update key and verify email notification

This commit is contained in:
Kyle Spearrin
2017-07-01 22:44:10 -04:00
parent 7ff79a0fdd
commit 5d81ed6a96
7 changed files with 146 additions and 8 deletions

View File

@@ -0,0 +1,37 @@
angular
.module('bit.settings')
.controller('settingsUpdateKeyController', function ($scope, $state, apiService, $uibModalInstance,
cryptoService, authService, cipherService, validationService, toastr, $analytics) {
$analytics.eventTrack('settingsUpdateKeyController', { category: 'Modal' });
$scope.save = function (form) {
var encKey = cryptoService.getEncKey();
if (encKey) {
validationService.addError(form, 'MasterPasswordHash',
'You do not need to update. You are already using the new encryption key.', true);
return;
}
$scope.processing = true;
var mpHash = cryptoService.hashPassword($scope.masterPassword);
$scope.savePromise = cipherService.updateKey(mpHash, function () {
$uibModalInstance.dismiss('cancel');
authService.logOut();
$analytics.eventTrack('Key Updated');
return $state.go('frontend.login.info');
}).then(function () {
toastr.success('Please log back in. If you are using other bitwarden applications, ' +
'log out and back in to those as well.', 'Key Updated', { timeOut: 10000 });
}, processError);
};
function processError() {
$uibModalInstance.dismiss('cancel');
toastr.error('Something went wrong.', 'Oh No!');
}
$scope.close = function () {
$uibModalInstance.dismiss('cancel');
};
});