Skip to content

Commit b984a15

Browse files
committed
fix: send code to sign
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent e163630 commit b984a15

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

lib/Service/IdentifyMethod/SignatureMethod/IToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
namespace OCA\Libresign\Service\IdentifyMethod\SignatureMethod;
1010

1111
interface IToken {
12-
public function requestCode(string $identify): void;
12+
public function requestCode(string $identify, string $method): void;
1313
}

lib/Service/IdentifyMethod/SignatureMethod/TokenService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(
2626
) {
2727
}
2828

29-
public function sendCodeByGateway(string $identifier, string $code, string $gatewayName): string {
29+
public function sendCodeByGateway(string $identifier, string $gatewayName): string {
3030
$gateway = $this->getGateway($gatewayName);
3131

3232
$code = $this->secureRandom->generate(self::TOKEN_LENGTH, ISecureRandom::CHAR_DIGITS);

lib/Service/IdentifyMethod/SignatureMethod/TwofactorGatewayToken.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,18 @@ private function blurIdentifier(string $identifier, int $visibleStart = 2, int $
6767
return $start . str_repeat('*', $maskedLength) . $end;
6868
}
6969

70-
public function requestCode(string $identify): void {
70+
public function requestCode(string $identify, string $method): void {
7171
$signRequestMapper = $this->identifyService->getSignRequestMapper();
7272
$signRequest = $signRequestMapper->getById($this->getEntity()->getSignRequestId());
7373
$displayName = $signRequest->getDisplayName();
7474
if ($identify === $displayName) {
7575
$displayName = '';
7676
}
77-
$code = $this->tokenService->sendCodeByEmail($identify, $displayName);
77+
if ($method === 'email') {
78+
$code = $this->tokenService->sendCodeByEmail($identify, $displayName);
79+
} else {
80+
$code = $this->tokenService->sendCodeByGateway($identify, $method);
81+
}
7882
$this->getEntity()->setCode($code);
7983
$this->identifyService->save($this->getEntity());
8084
}

lib/Service/SignFileService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public function requestCode(
612612
continue;
613613
}
614614
/** @var IToken $signatureMethod */
615-
$signatureMethod->requestCode($identify);
615+
$signatureMethod->requestCode($identify, $identifyMethod->getEntity()->getIdentifierKey());
616616
return;
617617
}
618618
throw new LibresignException($this->l10n->t('Sending authorization code not enabled.'));

0 commit comments

Comments
 (0)