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 {
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;
}
async breachedAccounts(email: string): Promise<BreachAccountResponse[]> {
const response = await fetch(HibpBreachApi + email);
async breachedAccounts(username: string): Promise<BreachAccountResponse[]> {
const response = await fetch(HibpBreachApi + username);
if (response.status === 404) {
return [];
} else if (response.status !== 200) {