Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var StrongPassword validator.Func = func(fl validator.FieldLevel) bool { password, ok := fl.Field().Interface().(string) if !ok { return false } var ( hasUpper = false hasLower = false hasNumber = false hasSpecial = false ) for _, char := range password { switch { case unicode.IsUpper(char): hasUpper = true case unicode.IsLower(char): hasLower = true case unicode.IsDigit(char): hasNumber = true case unicode.IsPunct(char) || unicode.IsSymbol(char): hasSpecial = true } } return hasUpper && hasLower && hasNumber && hasSpecial }
Functions ¶
func CheckPassword ¶
func HashPassword ¶
func RandomString ¶
RandomString generates a random string of length n
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.