Add a notification when filled password length exceeds the fields maxLength

This commit is contained in:
varjolintu 2022-04-09 17:17:59 +03:00
parent adeb6add9a
commit 2a763cc6c3
2 changed files with 9 additions and 0 deletions

View file

@ -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"

View file

@ -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);
}