diff --git a/src/app/vault/add-edit.component.html b/src/app/vault/add-edit.component.html index 445d849785f..cdcbe620838 100644 --- a/src/app/vault/add-edit.component.html +++ b/src/app/vault/add-edit.component.html @@ -35,6 +35,12 @@ [(ngModel)]="cipher.login.password">
+ ; deletePromise: Promise; + checkPasswordPromise: Promise; showPassword: boolean = false; cipherType = CipherType; fieldType = FieldType; @@ -60,7 +62,8 @@ export class AddEditComponent implements OnChanges { constructor(private cipherService: CipherService, private folderService: FolderService, private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, - private analytics: Angulartics2, private toasterService: ToasterService) { + private analytics: Angulartics2, private toasterService: ToasterService, + private auditService: AuditService) { this.typeOptions = [ { name: i18nService.t('typeLogin'), value: CipherType.Login }, { name: i18nService.t('typeCard'), value: CipherType.Card }, @@ -216,4 +219,20 @@ export class AddEditComponent implements OnChanges { const f = (field as any); f.showValue = !f.showValue; } + + async checkPassword() { + if (this.cipher.login == null || this.cipher.login.password == null || this.cipher.login.password === '') { + return; + } + + this.analytics.eventTrack.next({ action: 'Check Password' }); + this.checkPasswordPromise = this.auditService.passwordLeaked(this.cipher.login.password); + const matches = await this.checkPasswordPromise; + + if (matches > 0) { + this.toasterService.popAsync('warning', null, this.i18nService.t('passwordExposed', matches.toString())); + } else { + this.toasterService.popAsync('success', null, this.i18nService.t('passwordSafe')); + } + } } diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 5b1f69262f6..79927f9babd 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -959,7 +959,7 @@ "message": "Window" }, "checkPassword": { - "message": "Check if this password has been exposed." + "message": "Check if password has been exposed." }, "passwordExposed": { "message": "This password has been exposed $VALUE$ time(s) in data breaches. You should change it.",