Revert "fix"

This reverts commit 691456af87cbcef22668ffd9e77ef091e960f5a5.
This commit is contained in:
Aditya Siregar 2025-09-16 19:31:28 +07:00
parent b37d21d366
commit 36c2352cb2

View File

@ -107,21 +107,14 @@ func maskPhoneNumber(phone *string) string {
} }
phoneStr := *phone phoneStr := *phone
if len(phoneStr) <= 4 {
// Normalize: replace leading "62" with "0" return strings.Repeat("*", len(phoneStr))
if strings.HasPrefix(phoneStr, "62") {
phoneStr = "0" + phoneStr[2:]
} }
// If phone length <= 8, just mask the middle // Show first 2 and last 2 characters, mask the middle
if len(phoneStr) <= 8 { start := phoneStr[:2]
return phoneStr end := phoneStr[len(phoneStr)-2:]
} middle := strings.Repeat("*", len(phoneStr)-4)
// Show first 4 and last 4 characters
start := phoneStr[:4]
end := phoneStr[len(phoneStr)-4:]
middle := strings.Repeat("*", len(phoneStr)-8)
return start + middle + end return start + middle + end
} }