From d6bdd48bd44a140b088f748134be62bd672e0525 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 11 Jan 2025 17:19:40 -0300 Subject: [PATCH] chore: check if is validating from email before throw exception Signed-off-by: Vitor Mattos --- .../IdentifyMethod/AbstractIdentifyMethod.php | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php b/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php index 07bb5b45f..dad333256 100644 --- a/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php +++ b/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php @@ -225,22 +225,25 @@ protected function throwIfRenewalIntervalExpired(): void { ]); if ($lastActionDate + $renewalInterval < $now) { $this->identifyService->getLogger()->debug('AbstractIdentifyMethod::throwIfRenewalIntervalExpired Exception'); - $blur = new Blur($this->getEntity()->getIdentifierValue()); - throw new LibresignException(json_encode([ - 'action' => $this->getRenewAction(), - // TRANSLATORS title that is displayed at screen to notify the signer that the link to sign the document expired - 'title' => $this->identifyService->getL10n()->t('Link expired'), - 'body' => $this->identifyService->getL10n()->t(<<<'BODY' - The link to sign the document has expired. - We will send a new link to the email %1$s. - Click below to receive the new link and be able to sign the document. - BODY, - [$blur->make()] - ), - 'uuid' => $signRequest->getUuid(), - // TRANSLATORS Button to renew the link to sign the document. Renew is the action to generate a new sign link when the link expired. - 'renewButton' => $this->identifyService->getL10n()->t('Renew'), - ])); + if ($this->getName() === 'email') { + $blur = new Blur($this->getEntity()->getIdentifierValue()); + throw new LibresignException(json_encode([ + 'action' => $this->getRenewAction(), + // TRANSLATORS title that is displayed at screen to notify the signer that the link to sign the document expired + 'title' => $this->identifyService->getL10n()->t('Link expired'), + 'body' => $this->identifyService->getL10n()->t(<<<'BODY' + The link to sign the document has expired. + We will send a new link to the email %1$s. + Click below to receive the new link and be able to sign the document. + BODY, + [$blur->make()] + ), + 'uuid' => $signRequest->getUuid(), + // TRANSLATORS Button to renew the link to sign the document. Renew is the action to generate a new sign link when the link expired. + 'renewButton' => $this->identifyService->getL10n()->t('Renew'), + ])); + } + $this->validateToRenew($this->user); } }