From af12f0cba647f6f645bc8e8632f3a5d03e3a2dea Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Wed, 8 Oct 2025 19:13:12 -0300 Subject: [PATCH] fix: remove validation at serialization function This funcion need to be only to convert the data of this class to array, validation here isn't good to have. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .../IdentifyMethod/SignatureMethod/EmailToken.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php b/lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php index 9a970d971..df3cfbeea 100644 --- a/lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php +++ b/lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php @@ -41,13 +41,6 @@ class EmailToken extends AbstractSignatureMethod implements IToken { default => '', }; - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - throw new LibresignException(json_encode([ - 'action' => JSActions::ACTION_DO_NOTHING, - 'errors' => [['message' => $this->identifyService->getL10n()->t('Invalid email')]], - ])); - } - $emailLowercase = strtolower($email); $code = $entity->getCode(); @@ -63,8 +56,8 @@ class EmailToken extends AbstractSignatureMethod implements IToken { $return['identifyMethod'] = $entity->getIdentifierKey(); $return['needCode'] = $needCode; $return['hasConfirmCode'] = $hasConfirmCode; - $return['blurredEmail'] = $this->blurEmail($emailLowercase); - $return['hashOfEmail'] = md5($emailLowercase); + $return['blurredEmail'] = $emailLowercase ? $this->blurEmail($emailLowercase) : ''; + $return['hashOfEmail'] = $emailLowercase ? md5($emailLowercase) : ''; return $return; }