2022-04-15 09:42:07 +02:00
|
|
|
package clean
|
2021-12-15 12:24:05 +01:00
|
|
|
|
|
|
|
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
|
|
|
}
|