Move regular expressions for user name from Account to ExternalId
User names are stored as external IDs, hence the regular expressions to validate the format of a user name should be part of the ExternalId class. There is one place in the GWT UI where user names are validated. Since the GWT UI doesn't have access to the ExternalId class it needs to copy two of the regular expressions. This should be OK since the format of user names is not expected to change and the GWT UI will be gone soon. It's actually a goal to remove all dependencies from the GWT UI on the Account class so that the Account class can be moved out of the reviewdb.client package and be turned into an immutable AutoValue type. Change-Id: I6ea7139019eb0e7f0e06efaf77ec4bd89d514006 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
committed by
David Pursehouse
parent
1ed9d84cee
commit
45bf80651a
@@ -111,7 +111,7 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
throw new BadRequestException("username must match URL");
|
||||
}
|
||||
|
||||
if (!username.matches(Account.USER_NAME_PATTERN)) {
|
||||
if (!username.matches(ExternalId.USER_NAME_PATTERN_REGEX)) {
|
||||
throw new BadRequestException(
|
||||
"Username '" + username + "' must contain only letters, numbers, _, - or .");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user