You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
560 B
Go

package main
import "fmt"
func validateUsername(username string) error {
if !IsWhitespaceFree(username) {
return fmt.Errorf(`username cannot contain spaces`)
}
if len(username) < 4 {
return fmt.Errorf(`username too short`)
}
if len(username) > 1000 {
return fmt.Errorf(`username too long`)
}
return nil
}
func validatePasswords(password, password2 string) error {
if password != password2 {
return fmt.Errorf(`the two password fields don't match`)
}
if len(password) == 0 {
return fmt.Errorf(`password cannot be empty`)
}
return nil
}