2021-12-15 12:24:05 +01:00
|
|
|
package sanitize
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/photoprism/photoprism/pkg/txt"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Username returns the normalized username (lowercase, whitespace trimmed).
|
|
|
|
func Username(s string) string {
|
2021-12-16 15:26:54 +01:00
|
|
|
s = strings.TrimSpace(s)
|
|
|
|
|
|
|
|
if s == "" || reject(s, txt.ClipUsername) {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
return strings.ToLower(s)
|
2021-12-15 12:24:05 +01:00
|
|
|
}
|