check password data breaches on view page

This commit is contained in:
Kyle Spearrin 2018-03-19 10:00:02 -04:00
parent 69bdac1555
commit 173687bc83
2 changed files with 20 additions and 2 deletions

View File

@ -2,8 +2,8 @@ angular
.module('bit.vault') .module('bit.vault')
.controller('vaultViewCipherController', function ($scope, $state, $stateParams, cipherService, toastr, .controller('vaultViewCipherController', function ($scope, $state, $stateParams, cipherService, toastr,
$analytics, i18nService, platformUtilsService, totpService, $timeout, tokenService, $window, cryptoService, SweetAlert, $analytics, i18nService, platformUtilsService, totpService, $timeout, tokenService, $window, cryptoService,
constantsService) { SweetAlert, constantsService, auditService) {
$scope.constants = constantsService; $scope.constants = constantsService;
$scope.i18n = i18nService; $scope.i18n = i18nService;
$scope.showAttachments = !platformUtilsService.isEdge(); $scope.showAttachments = !platformUtilsService.isEdge();
@ -184,6 +184,21 @@ angular
}); });
} }
$scope.checkPassword = function () {
if (!$scope.cipher.login || !$scope.cipher.login.password || $scope.cipher.login.password === '') {
return;
}
$analytics.eventTrack('Check Password');
auditService.passwordLeaked($scope.cipher.login.password).then(function (matches) {
if (matches != 0) {
toastr.error(i18nService.passwordExposed);
} else {
toastr.success(i18nService.passwordSafe);
}
});
};
function totpTick() { function totpTick() {
$timeout(function () { $timeout(function () {
var epoch = Math.round(new Date().getTime() / 1000.0); var epoch = Math.round(new Date().getTime() / 1000.0);

View File

@ -34,6 +34,9 @@
</div> </div>
<div class="list-section-item wrap" ng-if="cipher.login.password"> <div class="list-section-item wrap" ng-if="cipher.login.password">
<div class="action-buttons"> <div class="action-buttons">
<a class="btn-list" href="" title="{{i18n.checkPassword}}" ng-click="checkPassword()">
<i class="fa fa-lg fa-check-circle"></i>
</a>
<a class="btn-list" href="" title="{{i18n.togglePassword}}" ng-click="togglePassword()"> <a class="btn-list" href="" title="{{i18n.togglePassword}}" ng-click="togglePassword()">
<i class="fa fa-lg" ng-class="[{'fa-eye': !showPassword}, {'fa-eye-slash': showPassword}]"></i> <i class="fa fa-lg" ng-class="[{'fa-eye': !showPassword}, {'fa-eye-slash': showPassword}]"></i>
</a> </a>