From 77123756b6330ae5ff5ce12d1c27ed73970229a4 Mon Sep 17 00:00:00 2001 From: Dennis Ploeger Date: Thu, 3 Jan 2019 09:11:06 +0100 Subject: [PATCH] Introduced a tooltip to make the secure field feature more understandable Fixes #805 --- app/scripts/locales/base.json | 2 ++ app/scripts/views/fields/field-view-custom.js | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/app/scripts/locales/base.json b/app/scripts/locales/base.json index 8bb68d7c..68820492 100644 --- a/app/scripts/locales/base.json +++ b/app/scripts/locales/base.json @@ -268,6 +268,8 @@ "detOtpQrErrorBody": "Sorry, we could not read the QR code, please try once again or contact the app authors with error details.", "detOtpQrWrong": "Wrong QR code", "detOtpQrWrongBody": "Your QR code was successfully scanned but it doesn't contain one-time password data.", + "detLockField": "Lock this field, so its content isn't searchable and visible. Displaying the content requires explicitly clicking it.", + "detUnlockField": "Unlock this field, making its content searchable and visible immediately", "autoTypeEntryFields": "Entry fields", "autoTypeModifiers": "Modifier keys", diff --git a/app/scripts/views/fields/field-view-custom.js b/app/scripts/views/fields/field-view-custom.js index 69095174..2ca21ca6 100644 --- a/app/scripts/views/fields/field-view-custom.js +++ b/app/scripts/views/fields/field-view-custom.js @@ -3,6 +3,8 @@ const FieldViewText = require('./field-view-text'); const FieldView = require('./field-view'); const Keys = require('../../const/keys'); const kdbxweb = require('kdbxweb'); +const Tip = require('../../util/tip'); +const Locale = require('../../util/locale'); const FieldViewCustom = FieldViewText.extend({ events: { @@ -23,6 +25,14 @@ const FieldViewCustom = FieldViewText.extend({ $('
').addClass('details__field-value-btn details__field-value-btn-protect') .appendTo(this.valueEl) .mousedown(this.protectBtnClick.bind(this)); + let securityTipTitle = Locale.detLockField; + if (this.isProtected) { + securityTipTitle = Locale.detUnlockField; + } + const securityTip = new Tip($(this.valueEl).find('.details__field-value-btn'), { + title: securityTipTitle + }); + securityTip.init(); }, endEdit: function(newVal, extra) {