Skip to content

Commit c5edfe9

Browse files
docs(i18n): add translator note for blocked signing message
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent a85bc45 commit c5edfe9

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

src/views/SignPDF/_partials/Sign.vue

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
<Signatures v-if="hasSignatures" />
99
</div>
1010
<div v-if="!loading" class="button-wrapper">
11+
<NcNoteCard v-for="(error, index) in signStore.errors"
12+
:key="index"
13+
:heading="error.title || ''"
14+
type="error">
15+
<NcRichText :text="error.message"
16+
:use-markdown="true" />
17+
</NcNoteCard>
1118
<div v-if="needCreateSignature" class="no-signature-warning">
1219
<p>
1320
{{ t('libresign', 'You do not have any signature defined.') }}
@@ -44,6 +51,17 @@
4451
<div v-else-if="needIdentificationDocuments" class="no-identification-warning">
4552
<Documents :sign-request-uuid="signRequestUuid" />
4653
</div>
54+
<div v-else-if="hasBlockingSignError" class="sign-blocked-warning">
55+
<p>
56+
<!-- TRANSLATORS Shown after a non-retriable certificate validation failure. "Signing is blocked" means the signer cannot continue now and must resolve the certificate issue first. -->
57+
{{ t('libresign', 'Signing is blocked until the certificate validation issue is resolved.') }}
58+
</p>
59+
<NcButton :wide="true"
60+
:disabled="loading"
61+
@click="clearBlockingSignError">
62+
{{ t('libresign', 'Try signing again') }}
63+
</NcButton>
64+
</div>
4765
<NcButton v-else-if="ableToSign"
4866
:wide="true"
4967
:disabled="loading"
@@ -283,6 +301,13 @@ defineOptions({
283301
this.actionHandler.showModal(modalCode)
284302
}
285303
304+
const shouldCloseModal = (methodConfig.modalCode || methodConfig.method || 'token') === 'password'
305+
&& Array.isArray(signError.errors)
306+
&& signError.errors.some((error) => Number(error?.code) === 422)
307+
if (shouldCloseModal) {
308+
this.actionHandler.closeModal(methodConfig.modalCode || methodConfig.method || 'token')
309+
}
310+
286311
this.signStore.setSigningErrors(signError.errors || [])
287312
} finally {
288313
this.loading = false
@@ -346,6 +371,21 @@ type SignSubmissionError = {
346371
errors?: SignError[]
347372
}
348373
374+
const NON_RETRIABLE_SIGN_ERROR_CODE = 422
375+
376+
function shouldCloseCurrentModalOnSignError(
377+
methodConfig: SignatureMethodConfig,
378+
signError: SignSubmissionError,
379+
): boolean {
380+
const modalCode = methodConfig.modalCode || methodConfig.method || 'token'
381+
if (modalCode !== 'password') {
382+
return false
383+
}
384+
385+
const errors = Array.isArray(signError.errors) ? signError.errors : []
386+
return errors.some((error) => Number(error?.code) === NON_RETRIABLE_SIGN_ERROR_CODE)
387+
}
388+
349389
type SignStoreContract = ReturnType<typeof useSignStore> & {
350390
document: SignDocument
351391
errors: SignError[]
@@ -455,6 +495,7 @@ const canCreateSignature = computed(() => {
455495
return capabilities.libresign?.config['sign-elements']['can-create-signature'] === true
456496
})
457497
const ableToSign = computed(() => signStore.ableToSign)
498+
const hasBlockingSignError = computed(() => signStore.errors.some((error) => Number(error?.code) === NON_RETRIABLE_SIGN_ERROR_CODE))
458499
const signRequestUuid = computed(() => {
459500
const doc = signStore.document
460501
const signer = doc?.signers?.find((row) => row.me) ?? doc?.signers?.[0]
@@ -524,6 +565,10 @@ function onSignatureFileCreated() {
524565
showManagePassword.value = false
525566
}
526567
568+
function clearBlockingSignError() {
569+
signStore.clearSigningErrors()
570+
}
571+
527572
function saveSignature() {
528573
if (signatureElementsStore.success.length) {
529574
showSuccess(signatureElementsStore.success)
@@ -645,6 +690,10 @@ let submitSignature = async (methodConfig: SignatureMethodConfig = {}) => {
645690
actionHandler!.showModal(modalCode)
646691
}
647692
693+
if (shouldCloseCurrentModalOnSignError(methodConfig, signError)) {
694+
actionHandler!.closeModal(methodConfig.modalCode || methodConfig.method || 'token')
695+
}
696+
648697
signStore.setSigningErrors(signError.errors || [])
649698
} finally {
650699
loading.value = false
@@ -793,6 +842,13 @@ defineExpose({
793842
margin-top: 1em;
794843
}
795844
845+
.sign-blocked-warning {
846+
margin-top: 1em;
847+
display: flex;
848+
flex-direction: column;
849+
gap: 8px;
850+
}
851+
796852
.button-wrapper {
797853
padding: calc(var(--default-grid-baseline, 4px)*2);
798854
}

0 commit comments

Comments
 (0)