Merge pull request #1596 from keepassxreboot/feature/warn_about_password_field_maxlen

Add a notification when filled password length exceeds field's max length
This commit is contained in:
Sami Vänttinen 2022-04-09 17:26:42 +03:00 committed by GitHub
commit a54c589bd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);
}