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
parent 2bf19ee6ee
commit f1513ada38
6 changed files with 6 additions and 6 deletions

View File

@@ -119,7 +119,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 .");
}