Fix email masking: show at least half the local part (min 4 chars)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
bd421af05d
commit
ad9d1761d2
@@ -1186,8 +1186,9 @@ class TelegramBotService
|
|||||||
private function maskEmail(string $email): string
|
private function maskEmail(string $email): string
|
||||||
{
|
{
|
||||||
[$local, $domain] = explode('@', $email, 2);
|
[$local, $domain] = explode('@', $email, 2);
|
||||||
$visible = mb_substr($local, 0, min(3, mb_strlen($local)));
|
$len = mb_strlen($local);
|
||||||
return $visible . str_repeat('*', max(0, mb_strlen($local) - 3)) . '@' . $domain;
|
$visible = max(4, (int) ceil($len / 2)); // muestra la mitad, mínimo 4 caracteres
|
||||||
|
return mb_substr($local, 0, min($visible, $len)) . str_repeat('*', max(0, $len - $visible)) . '@' . $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createMPPreference(string $titulo, int $valor, string $ref): ?string
|
private function createMPPreference(string $titulo, int $valor, string $ref): ?string
|
||||||
|
|||||||
Reference in New Issue
Block a user