func ValidateUserInput(k, v string, opts map[string]interface{}) error {
	if v == "" {
		return fmt.Errorf("empty %s value", k)
	}
	switch k {
	case "handle":
		if err := ValidateUserInputHandle(v, opts); err != nil {
			return err
		}
	case "secret":
		if err := ValidateUserInputSecret(v, opts); err != nil {
			return err
		}
	case "email":
		if err := ValidateUserInputEmail(v, opts); err != nil {
			return err
		}
	default:
		return fmt.Errorf("%s validation is unsupported", k)
	}
	return nil
}
ValidateUserInput provides generic interface to validate user input.
package validators
import (
	"fmt"
	"github.com/greenpau/caddy-auth-portal/pkg/utils"
	"net"
	"regexp"
	"strings"
)
const usernameCharset = "0123456789abcdefghijklmnopqrstuvwxyz"
var emailAddrRegex = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")