1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

cleanup of pwned password checker

This commit is contained in:
Kyle Spearrin
2018-02-28 11:49:25 -05:00
parent e12ecb0c14
commit ced108d1a6
4 changed files with 28 additions and 26 deletions

2
jslib

Submodule jslib updated: 902d72457c...e3b3e444db

View File

@@ -982,12 +982,12 @@
"message": "Complete your two-step login request using the new tab." "message": "Complete your two-step login request using the new tab."
}, },
"checkPassword": { "checkPassword": {
"message": "Check if the password have been previously exposed." "message": "Check if password has been exposed."
}, },
"passwordExposed": { "passwordExposed": {
"message": "This password have been previously exposed in data breaches!" "message": "This password has been exposed in data breaches. You should change it."
}, },
"passwordSafe": { "passwordSafe": {
"message": "This password was not found in a current data breach! It should be safe to use." "message": "This password was not found in any known data breaches. It should be safe to use."
} }
} }

View File

@@ -94,18 +94,19 @@ angular
$scope.showPassword = !$scope.showPassword; $scope.showPassword = !$scope.showPassword;
}; };
$scope.checkPassword = () => { $scope.checkPassword = function () {
$analytics.eventTrack('Check Password'); if (!$scope.cipher.login || !$scope.cipher.login.password || $scope.cipher.login.password === '') {
return;
}
auditService $analytics.eventTrack('Check Password');
.passwordLeaked($scope.cipher.login.password) auditService.passwordLeaked($scope.cipher.login.password).then(function (matches) {
.then((matches) => { if (matches != 0) {
if (matches != 0) { toastr.error(i18nService.passwordExposed);
toastr.error(i18nService.passwordExposed, i18nService.errorsOccurred); } else {
} else { toastr.success(i18nService.passwordSafe);
toastr.success(i18nService.passwordSafe) }
} });
})
}; };
$scope.addField = function (type) { $scope.addField = function (type) {

View File

@@ -112,18 +112,19 @@ angular
$scope.showPassword = !$scope.showPassword; $scope.showPassword = !$scope.showPassword;
}; };
$scope.checkPassword = () => { $scope.checkPassword = function () {
$analytics.eventTrack('Check Password'); if (!$scope.cipher.login || !$scope.cipher.login.password || $scope.cipher.login.password === '') {
return;
}
auditService $analytics.eventTrack('Check Password');
.passwordLeaked($scope.cipher.login.password) auditService.passwordLeaked($scope.cipher.login.password).then(function (matches) {
.then((matches) => { if (matches != 0) {
if (matches != 0) { toastr.error(i18nService.passwordExposed);
toastr.error(i18nService.passwordExposed, i18nService.errorsOccurred); } else {
} else { toastr.success(i18nService.passwordSafe);
toastr.success(i18nService.passwordSafe) }
} });
})
}; };
$scope.addField = function (type) { $scope.addField = function (type) {