Fix validation.

This commit is contained in:
takezoe
2013-06-21 18:38:26 +09:00
parent 2548d5d274
commit b20f85e21c
3 changed files with 19 additions and 7 deletions

View File

@@ -87,6 +87,8 @@ trait CreateRepositoryControllerBase extends ControllerBase {
def validate(name: String, value: String): Option[String] = {
if(!value.matches("^[a-zA-Z0-9\\-_]+$")){
Some("Repository name contains invalid character.")
} else if(value.startsWith("_") || value.startsWith("-")){
Some("Repository name starts with invalid character.")
} else if(getRepositoryNamesOfUser(context.loginAccount.get.userName).contains(value)){
Some("Repository already exists.")
} else {