verify the username, email and nickname are valid when registering via OAuth 2.0

This commit is contained in:
MaysWind
2025-10-23 22:46:31 +08:00
parent b21fff5b15
commit d3ab2b94b7
24 changed files with 189 additions and 140 deletions
+18
View File
@@ -0,0 +1,18 @@
package validators
import (
"github.com/go-playground/validator/v10"
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
// ValidNickname returns whether the given nick name is valid
func ValidNickname(fl validator.FieldLevel) bool {
if value, ok := fl.Field().Interface().(string); ok {
if utils.IsValidNickName(value) {
return true
}
}
return false
}