mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Ask for password on failed decryption
This commit is contained in:
parent
a017e105cc
commit
297c305150
3 changed files with 10 additions and 1 deletions
|
@ -1008,9 +1008,16 @@ var PDFView = {
|
|||
},
|
||||
function getDocumentError(message, exception) {
|
||||
if (exception && exception.name === 'PasswordException') {
|
||||
if (exception.code === 'needpassword') {
|
||||
if (exception.code === 'needpassword' ||
|
||||
exception.code === 'incorrectpassword') {
|
||||
var promptString = mozL10n.get('request_password', null,
|
||||
'PDF is protected by a password:');
|
||||
|
||||
if (exception.code === 'incorrectpassword') {
|
||||
promptString += '\n' + mozL10n.get('invalid_password', null,
|
||||
'Invalid Password.');
|
||||
}
|
||||
|
||||
password = prompt(promptString);
|
||||
if (password && password.length > 0) {
|
||||
return PDFView.open(url, scale, password);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue