Skip to content

Commit

Permalink
Merge pull request #23463 from tienifr/fix/23301-protected-pdf-loadin…
Browse files Browse the repository at this point in the history
…g-shows-even-when-error

Fix: `PDFPasswordForm` loads the PDF even when password validation fails
  • Loading branch information
yuwenmemon authored Jul 25, 2023
2 parents 6a4ce84 + 77a77b3 commit 3792a9a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/PDFView/PDFPasswordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,16 @@ class PDFPasswordForm extends Component {
}

validate() {
if (!_.isEmpty(this.state.password)) {
if (!this.props.isPasswordInvalid && !_.isEmpty(this.state.password)) {
return true;
}
this.setState({
validationErrorText: 'attachmentView.passwordRequired',
});

if (_.isEmpty(this.state.password)) {
this.setState({
validationErrorText: 'attachmentView.passwordRequired',
});
}

return false;
}

Expand Down

0 comments on commit 3792a9a

Please sign in to comment.