Enha: input check; hash passwords

This commit is contained in:
Grail Finder
2026-02-20 09:15:14 +03:00
parent f61de5645d
commit 83d4f88eb5
4 changed files with 136 additions and 4 deletions

View File

@@ -5,6 +5,10 @@ import (
"unicode"
)
const (
SaneLengthMax = 20
)
func RemoveSpacesFromStr(origin string) string {
return strings.Map(func(r rune) rune {
if unicode.IsSpace(r) {
@@ -35,3 +39,13 @@ func RemoveFromSlice(key string, sl []string) []string {
}
return resp
}
func IsInputSane(s string) bool {
if len(s) > SaneLengthMax {
return false
}
if strings.ContainsAny(s, "{}?!$&:/[]~") {
return false
}
return true
}