Use ExternalId.isValidUsername instead of ExternalId.USER_NAME_PATTERN_REGEX

Since ExternalId.USER_NAME_PATTERN_REGEX is now no longer used by
external callers it is made private.

Change-Id: Id7a108bf39baffc52273879bbf8973dbbea0ae0c
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2018-02-09 14:48:19 +01:00
committed by David Pursehouse
parent 45bf80651a
commit 7a5364662f
8 changed files with 8 additions and 11 deletions

View File

@@ -111,7 +111,7 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
throw new BadRequestException("username must match URL");
}
if (!username.matches(ExternalId.USER_NAME_PATTERN_REGEX)) {
if (!ExternalId.isValidUsername(username)) {
throw new BadRequestException(
"Username '" + username + "' must contain only letters, numbers, _, - or .");
}