1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

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')
.controller('vaultViewCipherController', function ($scope, $state, $stateParams, cipherService, toastr,
$analytics, i18nService, platformUtilsService, totpService, $timeout, tokenService, $window, cryptoService, SweetAlert,
constantsService) {
$analytics, i18nService, platformUtilsService, totpService, $timeout, tokenService, $window, cryptoService,
SweetAlert, constantsService, auditService) {
$scope.constants = constantsService;
$scope.i18n = i18nService;
$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() {
$timeout(function () {
var epoch = Math.round(new Date().getTime() / 1000.0);

View File

@ -34,6 +34,9 @@
</div>
<div class="list-section-item wrap" ng-if="cipher.login.password">
<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()">
<i class="fa fa-lg" ng-class="[{'fa-eye': !showPassword}, {'fa-eye-slash': showPassword}]"></i>
</a>