diff --git a/keepassxc-browser/_locales/en/messages.json b/keepassxc-browser/_locales/en/messages.json index b9920ca..68d1f1a 100644 --- a/keepassxc-browser/_locales/en/messages.json +++ b/keepassxc-browser/_locales/en/messages.json @@ -103,6 +103,10 @@ "message": "No logins found.", "description": "No logins found." }, + "errorMessagePaswordLengthExceeded": { + "message": "Filled password is longer than field's allowed max length.", + "description": "Error notification text shown when filled password is longer than defined maxLength of the input field." + }, "errorNotConnected": { "message": "Not connected to KeePassXC.", "description": "Error notification shown when not connected to KeePassXC" diff --git a/keepassxc-browser/content/fill.js b/keepassxc-browser/content/fill.js index 9b53b13..b6a5548 100644 --- a/keepassxc-browser/content/fill.js +++ b/keepassxc-browser/content/fill.js @@ -253,6 +253,11 @@ kpxcFill.fillInCredentials = async function(combination, predefinedUsername, uui // Fill password if (combination.password) { + // Show a notification if password length exceeds the length defined in input + if (combination.password.maxLength && selectedCredentials.password.length > combination.password.maxLength) { + kpxcUI.createNotification('error', tr('errorMessagePaswordLengthExceeded')); + } + kpxc.setValueWithChange(combination.password, selectedCredentials.password); await kpxc.setPasswordFilled(true); }