mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
39 lines
1.7 KiB
JavaScript
39 lines
1.7 KiB
JavaScript
angular
|
|
.module('bit.tools')
|
|
|
|
.controller('reportsBreachController', function ($scope, apiService, toastr, authService) {
|
|
$scope.loading = true;
|
|
$scope.error = false;
|
|
$scope.breachAccounts = [];
|
|
$scope.email = null;
|
|
|
|
$scope.$on('$viewContentLoaded', function () {
|
|
authService.getUserProfile().then(function (userProfile) {
|
|
$scope.email = userProfile.email;
|
|
return apiService.hibp.get({ email: $scope.email }).$promise;
|
|
}).then(function (response) {
|
|
var breachAccounts = [];
|
|
for (var i = 0; i < response.length; i++) {
|
|
var breach = {
|
|
id: response[i].Name,
|
|
title: response[i].Title,
|
|
domain: response[i].Domain,
|
|
date: new Date(response[i].BreachDate),
|
|
reportedDate: new Date(response[i].AddedDate),
|
|
modifiedDate: new Date(response[i].ModifiedDate),
|
|
count: response[i].PwnCount,
|
|
description: response[i].Description,
|
|
classes: response[i].DataClasses,
|
|
image: 'https://haveibeenpwned.com/Content/Images/PwnedLogos/' + response[i].Name + '.' + response[i].LogoType
|
|
};
|
|
breachAccounts.push(breach);
|
|
}
|
|
$scope.breachAccounts = breachAccounts;
|
|
$scope.loading = false;
|
|
}, function (response) {
|
|
$scope.error = response.status !== 404;
|
|
$scope.loading = false;
|
|
});
|
|
});
|
|
});
|