From 173687bc8355de7078e7d267895ac13697ebf5e6 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 19 Mar 2018 10:00:02 -0400 Subject: [PATCH] check password data breaches on view page --- .../app/vault/vaultViewCipherController.js | 19 +++++++++++++++++-- .../app/vault/views/vaultViewCipher.html | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/popup/app/vault/vaultViewCipherController.js b/src/popup/app/vault/vaultViewCipherController.js index a91ff2e5ba..40c53da470 100644 --- a/src/popup/app/vault/vaultViewCipherController.js +++ b/src/popup/app/vault/vaultViewCipherController.js @@ -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); diff --git a/src/popup/app/vault/views/vaultViewCipher.html b/src/popup/app/vault/views/vaultViewCipher.html index b3470e31cb..82ff3baa87 100644 --- a/src/popup/app/vault/views/vaultViewCipher.html +++ b/src/popup/app/vault/views/vaultViewCipher.html @@ -34,6 +34,9 @@