username: only ending with .app is reserved

This commit is contained in:
Girish Ramakrishnan
2025-01-25 16:03:10 +01:00
parent 0d4165421c
commit b43fa38350

View File

@@ -142,7 +142,7 @@ function validateUsername(username) {
if (/[^a-zA-Z0-9.-]/.test(username)) return new BoxError(BoxError.BAD_FIELD, 'Username can only contain alphanumerals, dot and -');
// app emails are sent using the .app suffix
if (username.indexOf('.app') !== -1) return new BoxError(BoxError.BAD_FIELD, 'Username pattern is reserved for apps');
if (username.endsWith('.app')) return new BoxError(BoxError.BAD_FIELD, 'Username pattern is reserved for apps');
return null;
}