breach check changed to username

This commit is contained in:
Kyle Spearrin 2018-06-29 08:20:28 -04:00
parent 93edd272dd
commit e297f39bd5
2 changed files with 3 additions and 3 deletions

View File

@ -2,5 +2,5 @@ import { BreachAccountResponse } from '../models/response/breachAccountResponse'
export abstract class AuditService { export abstract class AuditService {
passwordLeaked: (password: string) => Promise<number>; passwordLeaked: (password: string) => Promise<number>;
breachedAccounts: (email: string) => Promise<BreachAccountResponse[]>; breachedAccounts: (username: string) => Promise<BreachAccountResponse[]>;
} }

View File

@ -26,8 +26,8 @@ export class AuditService implements AuditServiceAbstraction {
return match != null ? parseInt(match.split(':')[1], 10) : 0; return match != null ? parseInt(match.split(':')[1], 10) : 0;
} }
async breachedAccounts(email: string): Promise<BreachAccountResponse[]> { async breachedAccounts(username: string): Promise<BreachAccountResponse[]> {
const response = await fetch(HibpBreachApi + email); const response = await fetch(HibpBreachApi + username);
if (response.status === 404) { if (response.status === 404) {
return []; return [];
} else if (response.status !== 200) { } else if (response.status !== 200) {