Skip to content

Commit af12f0c

Browse files
committed
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 <[email protected]>
1 parent 4e50c6c commit af12f0c

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ public function toArray(): array {
4141
default => '',
4242
};
4343

44-
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
45-
throw new LibresignException(json_encode([
46-
'action' => JSActions::ACTION_DO_NOTHING,
47-
'errors' => [['message' => $this->identifyService->getL10n()->t('Invalid email')]],
48-
]));
49-
}
50-
5144
$emailLowercase = strtolower($email);
5245

5346
$code = $entity->getCode();
@@ -63,8 +56,8 @@ public function toArray(): array {
6356
$return['identifyMethod'] = $entity->getIdentifierKey();
6457
$return['needCode'] = $needCode;
6558
$return['hasConfirmCode'] = $hasConfirmCode;
66-
$return['blurredEmail'] = $this->blurEmail($emailLowercase);
67-
$return['hashOfEmail'] = md5($emailLowercase);
59+
$return['blurredEmail'] = $emailLowercase ? $this->blurEmail($emailLowercase) : '';
60+
$return['hashOfEmail'] = $emailLowercase ? md5($emailLowercase) : '';
6861
return $return;
6962
}
7063

0 commit comments

Comments
 (0)