mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-10 06:08:34 +02:00
22 lines
805 B
JavaScript
22 lines
805 B
JavaScript
angular
|
|
.module('bit.accounts')
|
|
|
|
.controller('accountsRecoverController', function ($scope, apiService, cryptoService, $analytics) {
|
|
$scope.success = false;
|
|
|
|
$scope.submit = function (model) {
|
|
var email = model.email.toLowerCase();
|
|
|
|
$scope.submitPromise = cryptoService.makeKeyAndHash(model.email, model.masterPassword).then(function (result) {
|
|
return apiService.twoFactor.recover({
|
|
email: email,
|
|
masterPasswordHash: result.hash,
|
|
recoveryCode: model.code.replace(/\s/g, '').toLowerCase()
|
|
}).$promise;
|
|
}).then(function () {
|
|
$analytics.eventTrack('Recovered 2FA');
|
|
$scope.success = true;
|
|
});
|
|
};
|
|
});
|