ignore password quality warnings alert box

This commit is contained in:
antelle 2021-03-06 19:19:23 +01:00
parent 2f84474216
commit 828485789f
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
4 changed files with 60 additions and 3 deletions

View File

@ -316,6 +316,10 @@
"detIssuePwnedPassword": "This password has been exposed in a data breach according to {}, it's recommended to change it.",
"detIssuePasswordCheckError": "There was an error checking password strength online.",
"detIssueOldPassword": "The password is old.",
"detIssueCloseAlertHeader": "Hide password issues",
"detIssueCloseAlertBody": "There are different ways you can hide this warning:",
"detIssueCloseAlertEntry": "Don't show for this entry",
"detIssueCloseAlertSettings": "Adjust global settings",
"autoTypeEntryFields": "Entry fields",
"autoTypeModifiers": "Modifier keys",

View File

@ -627,6 +627,18 @@ class EntryModel extends Model {
return KdbxToHtml.entryToHtml(this.file.db, this.entry);
}
canCheckPasswordIssues() {
return !this.entry.customData?.IgnorePwIssues;
}
setIgnorePasswordIssues() {
if (!this.entry.customData) {
this.entry.customData = {};
}
this.entry.customData.IgnorePwIssues = '1';
this._entryModified();
}
static fromEntry(entry, group, file) {
const model = new EntryModel();
model.setEntry(entry, group, file);

View File

@ -686,10 +686,14 @@ class AppView extends View {
}
}
toggleSettings(page) {
toggleSettings(page, section) {
let menuItem = page ? this.model.menu[page + 'Section'] : null;
if (menuItem) {
menuItem = menuItem.items[0];
if (section) {
menuItem = menuItem.items.find((it) => it.section === section) || menuItem.items[0];
} else {
menuItem = menuItem.items[0];
}
}
if (this.views.settings) {
if (this.views.settings.page === page || !menuItem) {

View File

@ -2,10 +2,12 @@ import { View } from 'framework/views/view';
import template from 'templates/details/details-issues.hbs';
import { Alerts } from 'comp/ui/alerts';
import { Timeouts } from 'const/timeouts';
import { Locale } from 'util/locale';
import { passwordStrength, PasswordStrengthLevel } from 'util/data/password-strength';
import { AppSettingsModel } from 'models/app-settings-model';
import { Links } from 'const/links';
import { checkIfPasswordIsExposedOnline } from 'comp/app/online-password-checker';
import { Events } from '../../framework/events';
class DetailsIssuesView extends View {
parent = '.details__issues-container';
@ -60,6 +62,10 @@ class DetailsIssuesView extends View {
}
checkPasswordIssues() {
if (!this.model.canCheckPasswordIssues()) {
this.passwordIssue = null;
return;
}
const { password } = this.model;
if (!password || !password.isProtected || !password.byteLength) {
this.passwordIssue = null;
@ -116,7 +122,38 @@ class DetailsIssuesView extends View {
}
closeIssuesClick() {
Alerts.notImplemented();
Alerts.alert({
header: Locale.detIssueCloseAlertHeader,
body: Locale.detIssueCloseAlertBody,
icon: 'exclamation-triangle',
buttons: [
{ result: 'entry', title: Locale.detIssueCloseAlertEntry, silent: true },
{ result: 'settings', title: Locale.detIssueCloseAlertSettings, silent: true },
Alerts.buttons.cancel
],
esc: '',
click: '',
success: (result) => {
switch (result) {
case 'entry':
this.disableAuditForEntry();
break;
case 'settings':
this.openAuditSettings();
break;
}
}
});
}
disableAuditForEntry() {
this.model.setIgnorePasswordIssues();
this.checkPasswordIssues();
this.render();
}
openAuditSettings() {
Events.emit('toggle-settings', 'general', 'audit');
}
}