update validation of usernames

This commit is contained in:
Matthew R. Kasun
2022-06-27 13:51:09 -04:00
parent f65925c70c
commit 0c4f5b100b
2 changed files with 19 additions and 2 deletions

View File

@@ -229,6 +229,10 @@ func UpdateUser(userchange models.User, user models.User) (models.User, error) {
func ValidateUser(user models.User) error {
v := validator.New()
_ = v.RegisterValidation("in_charset", func(fl validator.FieldLevel) bool {
isgood := user.NameInCharSet()
return isgood
})
err := v.Struct(user)
if err != nil {