Merge pull request #27890 from overleaf/jlm-spam-safe-email

Apply new spam check to email address

GitOrigin-RevId: 9e204ea75e930455971769a73843d015fc4a9033
This commit is contained in:
John Lees-Miller
2025-08-14 08:06:28 +00:00
committed by Copybot
parent 671059fdfc
commit aa10bc92af
2 changed files with 13 additions and 1 deletions
@@ -34,7 +34,14 @@ const SpamSafe = {
},
isSafeEmail(email) {
return EMAIL_REGEX.test(email) && email.length <= 40
if (!EMAIL_REGEX.test(email) || email.length > 40) {
return false
}
// All-digits, e.g. qq, is safe, but mixed digits and letters is not.
const localPart = email.split('@')[0]
const digitCount = countDigits(localPart)
return digitCount === localPart.length || digitCount <= 5
},
safeUserName(name, alternative, project) {