mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
move reports to their own module
This commit is contained in:
38
src/app/reports/reportsBreachController.js
Normal file
38
src/app/reports/reportsBreachController.js
Normal file
@@ -0,0 +1,38 @@
|
||||
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;
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user