fix: email mask shows max 4 chars instead of half the local part
lizandro.guarnizo (17 chars) was showing 'lizandro.' (9 chars including the dot) because ceil(17/2)=9. Now always shows exactly min(4, len) chars: 'liza*************@domain' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
9a13bad235
commit
30fc8c0f1b
@@ -331,8 +331,9 @@ class PublicChat extends Component
|
||||
private function enmascararEmail(string $email): string
|
||||
{
|
||||
[$local, $dominio] = explode('@', $email, 2);
|
||||
$visible = mb_substr($local, 0, min(3, mb_strlen($local)));
|
||||
return $visible . str_repeat('*', max(0, mb_strlen($local) - 3)) . '@' . $dominio;
|
||||
$n = min(4, mb_strlen($local));
|
||||
$visible = mb_substr($local, 0, $n);
|
||||
return $visible . str_repeat('*', max(0, mb_strlen($local) - $n)) . '@' . $dominio;
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user