returnnil,impart.HTTPError{http.StatusBadRequest,"A username is required."}
}
ifsignup.Pass==""{
returnnil,impart.HTTPError{http.StatusBadRequest,"A password is required."}
}
vardesiredUsernamestring
ifsignup.Normalize{
// With this option we simply conform the username to what we expect
// without complaining. Since they might've done something funny, like
// enter: write.as/Way Out There, we'll use their raw input for the new
// collection name and sanitize for the slug / username.
desiredUsername=signup.Alias
signup.Alias=getSlug(signup.Alias,"")
}
if!author.IsValidUsername(app.cfg,signup.Alias){
// Ensure the username is syntactically correct.
returnnil,impart.HTTPError{http.StatusPreconditionFailed,"Username is reserved or isn't valid. It must be at least 3 characters long, and can only include letters, numbers, and hyphens."}