mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 09:22:42 +08:00
update validation of usernames
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user