Skip to content

Commit e5b5c94

Browse files
committed
Merge pull request mozilla#3060 from saebekassebil/fixpassword
Ask for password on failed decryption
2 parents 5db963a + 297c305 commit e5b5c94

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

l10n/da/viewer.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ missing_file_error=Manglende PDF-fil
116116
# Nogle almindelige typer er f.eks.: "Check", "Text", "Comment" og "Note"
117117
text_annotation_type=[{{type}} Kommentar]
118118
request_password=PDF filen er beskyttet med et kodeord:
119+
invalid_password=Ugyldigt kodeord.
119120

120121
printing_not_supported=Advarsel: Denne browser er ikke fuldt understøttet ved udskrift.
121122
printing_not_ready=Advarsel: PDF-filen er ikke helt klar til udskrivning.

l10n/en-US/viewer.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ missing_file_error=Missing PDF file.
116116
# Some common types are e.g.: "Check", "Text", "Comment", "Note"
117117
text_annotation_type=[{{type}} Annotation]
118118
request_password=PDF is protected by a password:
119+
invalid_password=Invalid Password.
119120

120121
printing_not_supported=Warning: Printing is not fully supported by this browser.
121122
printing_not_ready=Warning: The PDF is not fully loaded for printing.

web/viewer.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,9 +1057,16 @@ var PDFView = {
10571057
},
10581058
function getDocumentError(message, exception) {
10591059
if (exception && exception.name === 'PasswordException') {
1060-
if (exception.code === 'needpassword') {
1060+
if (exception.code === 'needpassword' ||
1061+
exception.code === 'incorrectpassword') {
10611062
var promptString = mozL10n.get('request_password', null,
10621063
'PDF is protected by a password:');
1064+
1065+
if (exception.code === 'incorrectpassword') {
1066+
promptString += '\n' + mozL10n.get('invalid_password', null,
1067+
'Invalid Password.');
1068+
}
1069+
10631070
password = prompt(promptString);
10641071
if (password && password.length > 0) {
10651072
return PDFView.open(url, scale, password);

0 commit comments

Comments
 (0)