From 093071c8f370aaadbbaf266296967f2120edb2c7 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 28 Feb 2018 11:35:48 -0500 Subject: [PATCH] password breach check moved to view page --- jslib | 2 +- src/app/vault/add-edit.component.html | 4 ---- src/app/vault/add-edit.component.ts | 17 +---------------- src/app/vault/view.component.html | 6 ++++++ src/app/vault/view.component.ts | 21 ++++++++++++++++++++- src/locales/en/messages.json | 6 +++--- src/scss/variables.scss | 2 +- 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/jslib b/jslib index ab00dfd3991..e3b3e444dbf 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit ab00dfd3991c258065d452dfb14b11e90898143e +Subproject commit e3b3e444dbff7e4541fa5367ee26bc7ed4d73b26 diff --git a/src/app/vault/add-edit.component.html b/src/app/vault/add-edit.component.html index 10a05405451..445d849785f 100644 --- a/src/app/vault/add-edit.component.html +++ b/src/app/vault/add-edit.component.html @@ -35,10 +35,6 @@ [(ngModel)]="cipher.login.password">
- - - 0) { - this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'), - this.i18nService.t('passwordExposed', match.toString())); - } else { - this.toasterService.popAsync('success', null, this.i18nService.t('passwordSafe')); - } - } - toggleFieldValue(field: FieldView) { const f = (field as any); f.showValue = !f.showValue; diff --git a/src/app/vault/view.component.html b/src/app/vault/view.component.html index 5a0b0ddbdcc..b05f1b0f9db 100644 --- a/src/app/vault/view.component.html +++ b/src/app/vault/view.component.html @@ -47,6 +47,12 @@ {{cipher.login.password}}
+ ; private totpInterval: any; constructor(private cipherService: CipherService, private totpService: TotpService, private tokenService: TokenService, private toasterService: ToasterService, private cryptoService: CryptoService, private platformUtilsService: PlatformUtilsService, - private i18nService: I18nService, private analytics: Angulartics2) { } + private i18nService: I18nService, private analytics: Angulartics2, + private auditService: AuditService) { } async ngOnChanges() { this.cleanUp(); @@ -82,6 +85,22 @@ export class ViewComponent implements OnChanges, OnDestroy { this.showPassword = !this.showPassword; } + 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')); + } + } + toggleFieldValue(field: FieldView) { const f = (field as any); f.showValue = !f.showValue; diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 7e5b11d2b60..5b1f69262f6 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -959,14 +959,14 @@ "message": "Window" }, "checkPassword": { - "message": "Check if this password has been previously exposed." + "message": "Check if this password has been exposed." }, "passwordExposed": { - "message": "This password has been exposed in $VALUE$ data breach(es)! You should change it.", + "message": "This password has been exposed $VALUE$ time(s) in data breaches. You should change it.", "placeholders": { "value": { "content": "$1", - "example": "1" + "example": "2" } } }, diff --git a/src/scss/variables.scss b/src/scss/variables.scss index 13c84de46bb..15783351eaa 100644 --- a/src/scss/variables.scss +++ b/src/scss/variables.scss @@ -20,7 +20,7 @@ $brand-primary: #3c8dbc; $brand-danger: #dd4b39; $brand-success: #00a65a; $brand-info: #555555; -$brand-warning: #f39c12; +$brand-warning: #bf7e16; $brand-primary-accent: #286090; $background-color: white;