Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/internal route #3624

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,26 @@ public function signFPath(string $uuid): TemplateResponse {
return $this->index();
}

/**
* Sign page to authenticated signer
*
* The path is used only by frontend
*
* @param string $uuid Sign request uuid
* @return TemplateResponse<Http::STATUS_OK, array{}>
*
* 200: OK
*/
#[NoAdminRequired]
#[NoCSRFRequired]
#[RequireSetupOk]
#[PublicPage]
#[RequireSignRequestUuid]
#[FrontpageRoute(verb: 'GET', url: '/p/sign/{uuid}/pdf')]
public function signPdf(string $uuid): TemplateResponse {
return $this->sign($uuid);
}

/**
* Sign page to authenticated signer
*
Expand Down
14 changes: 10 additions & 4 deletions src/Components/RightSidebar/RequestSignatureTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
</NcButton>
</div>
<VisibleElements />
<NcModal v-if="modalSrc" size="full" @close="closeModal()">
<NcModal v-if="modalSrc"
size="full"
:can-close="false">
<iframe :src="modalSrc" class="iframe" />
</NcModal>
</div>
Expand Down Expand Up @@ -157,16 +159,20 @@ export default {
},
},
async mounted() {
window.addEventListener('message', this.closeModal)
subscribe('libresign:edit-signer', this.editSigner)
this.filesStore.disableIdentifySigner()
},
beforeUnmount() {
window.removeEventListener('message', this.closeModal)
unsubscribe('libresign:edit-signer')
},
methods: {
closeModal() {
this.modalSrc = ''
this.filesStore.flushSelectedFile()
closeModal(message) {
if (message.data.type === 'close-modal') {
this.modalSrc = ''
this.filesStore.flushSelectedFile()
}
},
validationFile() {
if (this.useModal) {
Expand Down
37 changes: 26 additions & 11 deletions src/views/SignPDF/_partials/Sign.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
<Signatures v-if="hasSignatures" />
</div>
<div v-if="!loading" class="button-wrapper">
<div v-if="ableToSign" class="button-wrapper">
<NcButton :wide="true"
:disabled="loading"
type="primary"
@click="confirmSignDocument">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
</template>
{{ t('libresign', 'Sign the document.') }}
</NcButton>
</div>
<NcButton v-if="ableToSign"
:wide="true"
:disabled="loading"
type="primary"
@click="confirmSignDocument">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
</template>
{{ t('libresign', 'Sign the document.') }}
</NcButton>
<div v-else-if="signMethodsStore.needCreatePassword()">
<p>
{{ t('libresign', 'Please define your sign password') }}
Expand Down Expand Up @@ -42,6 +41,13 @@
{{ t('libresign', 'Unable to sign.') }}
</p>
</div>
<NcButton v-if="isModal"
:wide="true"
:disabled="loading"
type="secondary"
@click="closeModal">
{{ t('libresign', 'Cancel') }}
</NcButton>
</div>
<NcDialog v-if="signMethodsStore.modal.clickToSign"
:can-close="!loading"
Expand Down Expand Up @@ -150,6 +156,7 @@ export default {
},
signPassword: '',
showManagePassword: false,
isModal: window.self !== window.top,
}
},
computed: {
Expand Down Expand Up @@ -213,6 +220,11 @@ export default {
}
}
},
closeModal() {
window.parent?.postMessage({
type: 'close-modal',
}, '*')
},
toggleManagePassword() {
this.showManagePassword = !this.showManagePassword
},
Expand Down Expand Up @@ -318,6 +330,9 @@ export default {
.button-wrapper {
padding: calc(var(--default-grid-baseline, 4px)*2);
display: flex;
flex-direction: column;
gap: 12px;
}
.sign-elements {
Expand Down
Loading