Skip to content

Commit

Permalink
Merge pull request #1542 from LibreSign/backport/1541/stable26
Browse files Browse the repository at this point in the history
[stable26] Fix save signature as image
  • Loading branch information
vitormattos authored Mar 28, 2023
2 parents 690e63c + 4ec32f1 commit 739fd40
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/Helper/ValidateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ public function validateBase64(string $base64, int $type = self::TYPE_TO_SIGN):

$mimeType = $this->mimeTypeDetector->detectString($string);

if ($mimeType !== 'application/pdf') {
if (
($type === self::TYPE_TO_SIGN && $mimeType !== 'application/pdf')
|| (in_array($type, [self::TYPE_VISIBLE_ELEMENT_USER, self::TYPE_VISIBLE_ELEMENT_PDF]) && $mimeType !== 'image/png')
) {
throw new LibresignException($this->l10n->t('File type: %s. Invalid base64 file.', [$this->getTypeOfFile($type)]));
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Components/Draw/FileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default {
this.imageData = canvas.toDataURL('image/png')
},
saveSignature() {
this.modal = false
this.$emit('save', this.imageData)
},
confirmSave() {
Expand Down
1 change: 1 addition & 0 deletions src/Components/Draw/TextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default {
methods: {
saveSignature() {
this.handleModal(false)
this.$emit('save', this.imageData)
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/Account/partials/Signature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export default {
padding: 15px;
margin: 5px;
border-radius: 10px;
background-color: #cecece;
background-color: var(--color-main-background);
box-shadow: 0 2px 9px var(--color-box-shadow);
cursor: pointer;
span{
cursor: inherit;
Expand Down

0 comments on commit 739fd40

Please sign in to comment.